Skip to content

Deploy and update Pulsar Functions with sync

Create, update and delete functions from a document.

Terminal recording of kurkik pulsar sync

The recording shows kurkik pulsar sync on the demo sandbox; its data differs from this example.

Shown here: one cluster. Other broker setups are further down.

What you get if you do not ask for the risky part:

$ kurkik pulsar sync a.yaml b --functions --dry-run
Sync a.yaml into b - Apache Pulsar, cluster b (http://pulsar-b:8080)
owns: namespaces shop/orders - the ones its channels live in; permissions, as x-kurkik.pulsar.server.acl declares them
plan: <digest>
Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (1)
+ deploy function shop/orders/normalise function (not set) -> shop/orders/normalise
note: A function, source or sink is deployed from the package or built-in connector the document names; its user configuration and secrets are not in a document, and are not set.
left alone (3)
differs function shop/orders/enrich settings --overwrite
kept function shop/orders/tidy function
Pulsar does not say which package the function shop/orders/tidy runs, so a revert could not deploy it again: it is not deleted. Delete it yourself (pulsar-admin functions delete) if it should go.
and 1 difference sync does not act on - servers, messages, undeclared settings; kurkik pulsar diff shows them
applying needs: tenant admin on shop; the functions permission on shop/orders (or tenant admin), and a function worker, to deploy or change what runs there
1 change - 1 still differs
Apache Pulsar has no rehearsal: the plan above is all of it. Nothing was changed.
exit 2

Nothing changes yet. --dry-run only shows what would happen.

$ kurkik pulsar sync a.yaml b --functions --overwrite --delete --dry-run
Sync a.yaml into b - Apache Pulsar, cluster b (http://pulsar-b:8080)
owns: namespaces shop/orders - the ones its channels live in; permissions, as x-kurkik.pulsar.server.acl declares them
plan: <digest>
Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (2)
~ update function shop/orders/enrich settings parallelism=2 -> parallelism=1
+ deploy function shop/orders/normalise function (not set) -> shop/orders/normalise
note: A function, source or sink is deployed from the package or built-in connector the document names; its user configuration and secrets are not in a document, and are not set.
left alone (2)
kept function shop/orders/tidy function
Pulsar does not say which package the function shop/orders/tidy runs, so a revert could not deploy it again: it is not deleted. Delete it yourself (pulsar-admin functions delete) if it should go.
and 1 difference sync does not act on - servers, messages, undeclared settings; kurkik pulsar diff shows them
applying needs: tenant admin on shop; the functions permission on shop/orders (or tenant admin), and a function worker, to deploy or change what runs there
2 changes
Apache Pulsar has no rehearsal: the plan above is all of it. Nothing was changed.
exit 2
$ kurkik pulsar sync a.yaml b --functions --overwrite --delete --yes
Sync a.yaml into b - Apache Pulsar, cluster b (http://pulsar-b:8080)
owns: namespaces shop/orders - the ones its channels live in; permissions, as x-kurkik.pulsar.server.acl declares them
plan: <digest>
Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (2)
~ update function shop/orders/enrich settings parallelism=2 -> parallelism=1
+ deploy function shop/orders/normalise function (not set) -> shop/orders/normalise
note: A function, source or sink is deployed from the package or built-in connector the document names; its user configuration and secrets are not in a document, and are not set.
left alone (2)
kept function shop/orders/tidy function
Pulsar does not say which package the function shop/orders/tidy runs, so a revert could not deploy it again: it is not deleted. Delete it yourself (pulsar-admin functions delete) if it should go.
and 1 difference sync does not act on - servers, messages, undeclared settings; kurkik pulsar diff shows them
applying needs: tenant admin on shop; the functions permission on shop/orders (or tenant admin), and a function worker, to deploy or change what runs there
2 changes
applied
[+] done update function shop/orders/enrich settings parallelism=2 -> parallelism=1
[+] done deploy function shop/orders/normalise function (not set) -> shop/orders/normalise
Applied 2 of 2 changes - 2 left alone
snapshot: ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml
rollback: ~/.local/state/kurkik/sync/b/b-<time>.rollback.yaml
undo: kurkik pulsar sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml
exit 0

Written before the first change.

rollback.yaml
system: "Apache Pulsar"
target: "b (http://pulsar-b:8080)"
createdAt: "<time>"
document: "~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml"
entries:
- forAction: "update-processor:function shop/orders/enrich:settings"
undo: "RESTORE_UPDATED_PROCESSOR"
target: "function shop/orders/enrich"
field: "settings"
note: "sync updated this. Undoing it updates it back to what it was; its instances\
\ restart again."
definition:
kind: "function"
name: "enrich"
namespace: "orders"
set.archive: "function://shop/orders/enrich@0"
set.className: "com.github.pakisan.kurkik.pulsar.fixtures.Enrich"
set.inputs: "persistent://shop/orders/created"
set.output: "persistent://shop/orders/enriched"
set.parallelism: "1"
set.processingGuarantees: "ATLEAST_ONCE"
set.runtime: "JAVA"
set.subscriptionName: "enrich"
tenant: "shop"
was.className: "com.github.pakisan.kurkik.pulsar.fixtures.Enrich"
was.inputs: "persistent://shop/orders/created"
was.output: "persistent://shop/orders/enriched"
was.parallelism: "2"
was.processingGuarantees: "ATLEAST_ONCE"
was.runtime: "JAVA"
was.subscriptionName: "enrich"
- forAction: "deploy-processor:function shop/orders/normalise:function"
undo: "DELETE_DEPLOYED_PROCESSOR"
target: "function shop/orders/normalise"
field: "function"
note: "sync deployed this. Undoing it stops and deletes it."
definition:
kind: "function"
name: "normalise"
namespace: "orders"
set.archive: "function://shop/orders/normalise@0"
set.className: "com.github.pakisan.kurkik.pulsar.fixtures.Normalise"
set.inputs: "persistent://shop/orders/paid"
set.output: "persistent://shop/orders/normalised"
set.parallelism: "1"
set.processingGuarantees: "ATLEAST_ONCE"
set.runtime: "JAVA"
set.subscriptionName: "normalise"
tenant: "shop"

Download rollback.yaml

$ kurkik pulsar diff a.yaml b --functions
a.yaml vs b
Functions, sources and sinks
+ function shop/orders/tidy function - The function shop/orders/tidy runs on b and not on a.yaml. (b: shop/orders/tidy)
Notes
- Not compared: ACLs, consumers, schemas, connectors, configuration. Add --acls --consumers --schemas --connectors --configs, or --all, to compare them.
Drift: 0 changed · 1 unmanaged · 0 missing (no drift) - 32 matched
exit 0
$ kurkik pulsar sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml b --force --yes
Revert b to b-<time>.snapshot.yaml - Apache Pulsar, cluster b (http://pulsar-b:8080)
owns: what the run being undone changed, as its rollback records it
plan: <digest>
Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (2)
- delete function shop/orders/normalise function [stops and deletes the processor]
function shop/orders/normalise stops: sync deployed it.
~ update function shop/orders/enrich settings
note: A function, source or sink is deployed from the package or built-in connector the document names; its user configuration and secrets are not in a document, and are not set.
applying needs: tenant admin on shop; the functions permission on shop/orders (or tenant admin), and a function worker, to deploy or change what runs there
2 changes, 1 destroy
applied
[+] done delete function shop/orders/normalise function
[+] done update function shop/orders/enrich settings
Applied 2 of 2 changes
snapshot: ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml
rollback: ~/.local/state/kurkik/sync/b/b-<time>.rollback.yaml
undo: kurkik pulsar sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml
exit 0

After the revert, compared with how it was before: Drift: 0 changed · 1 unmanaged · 0 missing (no drift) - 99 matched

source.yaml, 417 lines
asyncapi: 3.0.0
info:
title: a Apache Pulsar API
version: 1.0.0-SNAPSHOT
description: Generated by reading Apache Pulsar of a (http://pulsar-a:8080).
servers:
standalone:
host: pulsar-a:6650
protocol: pulsar
protocolVersion: "4.0"
description: Apache Pulsar cluster standalone.
bindings:
pulsar:
bindingVersion: 0.1.0
tenant: shop
x-kurkik:
pulsar:
server:
cluster: standalone
brokers:
- localhost:8080
schemaRegistryUrl: http://pulsar-a:8080
schemaRegistryVendor: pulsar
namespacePolicies:
public/default:
schema-autoupdate: "on"
shop/orders:
schema-autoupdate: "on"
tenants:
- tenant: public
adminRoles: []
allowedClusters:
- standalone
- tenant: shop
adminRoles:
- shop-admin
allowedClusters:
- standalone
security:
- security: NONE
tls: false
acl: []
consumers:
- subscription: enrich
type: Shared
topics:
- persistent://shop/orders/created
processor: function shop/orders/enrich
- subscription: normalise
type: Shared
topics:
- persistent://shop/orders/paid
processor: function shop/orders/normalise
producers: []
functions:
- tenant: shop
namespace: orders
name: enrich
runtime: JAVA
className: com.github.pakisan.kurkik.pulsar.fixtures.Enrich
archive: function://shop/orders/enrich@0
inputs:
- persistent://shop/orders/created
output: persistent://shop/orders/enriched
subscriptionName: enrich
parallelism: 1
processingGuarantees: ATLEAST_ONCE
channels:
- $ref: "#/channels/persistent-shop-orders-created"
- $ref: "#/channels/persistent-shop-orders-enriched"
roles: []
- tenant: shop
namespace: orders
name: normalise
runtime: JAVA
className: com.github.pakisan.kurkik.pulsar.fixtures.Normalise
archive: function://shop/orders/normalise@0
inputs:
- persistent://shop/orders/paid
output: persistent://shop/orders/normalised
subscriptionName: normalise
parallelism: 1
processingGuarantees: ATLEAST_ONCE
channels:
- $ref: "#/channels/persistent-shop-orders-paid"
- $ref: "#/channels/persistent-shop-orders-normalised"
roles: []
sources: []
sinks: []
brokerConfiguration:
advertisedAddress: localhost
backlogQuotaDefaultLimitGB: "10.0"
bookkeeperClientMinNumRacksPerWriteQuorum: "1"
bookkeeperClientReorderReadSequenceEnabled: "false"
bookkeeperNumberOfChannelsPerBookie: "1"
brokerDeleteInactiveTopicsEnabled: "false"
clusterName: standalone
enablePackagesManagement: "true"
forceDeleteNamespaceAllowed: "true"
functionsWorkerEnablePackageManagement: "true"
isRunningStandalone: "true"
loadBalancerEnabled: "false"
loadManagerClassName: org.apache.pulsar.broker.loadbalance.NoopLoadManager
managedLedgerCacheEvictionFrequency: "100.0"
managedLedgerDefaultAckQuorum: "1"
managedLedgerDefaultEnsembleSize: "1"
managedLedgerDefaultMarkDeleteRateLimit: "0.1"
managedLedgerDefaultWriteQuorum: "1"
metadataStoreUrl: rocksdb:///pulsar/data/metadata
packagesManagementStorageProvider: org.apache.pulsar.packages.management.storage.filesystem.FileSystemPackagesStorageProvider
statusFilePath: /usr/local/apache/htdocs
topicPublisherThrottlingTickTimeMillis: "2"
webSocketServiceEnabled: "true"
clientConfiguration:
serviceUrl: pulsar://pulsar-a:6650
webServiceUrl: http://pulsar-a:8080
producerConfiguration: {}
consumerConfiguration: {}
channels:
persistent-shop-orders-created:
address: persistent://shop/orders/created
messages:
persistent-shop-orders-created:
payload:
type: string
name: persistent-shop-orders-created
title: persistent://shop/orders/created
summary: "Schema read from Pulsar's own registry: STRING, version 0."
x-kurkik:
pulsar:
message:
schemaType: STRING
schemaVersion: 0
schemaIdLocation: metadata
schemaLookupStrategy: topic
schemaCompatibility: FULL
key:
type: string
bindings:
pulsar:
bindingVersion: 0.1.0
namespace: orders
persistence: persistent
x-kurkik:
pulsar:
channel:
topic: persistent://shop/orders/created
tenant: shop
namespace: orders
persistence: persistent
partitions: 0
geo-replication:
- standalone
topicConfiguration:
partitions: 0
persistence: persistent
replication-clusters:
- standalone
schema-autoupdate: "on"
persistent-shop-orders-enriched:
address: persistent://shop/orders/enriched
messages:
persistent-shop-orders-enriched:
payload:
type: string
name: persistent-shop-orders-enriched
title: persistent://shop/orders/enriched
summary: "Schema read from Pulsar's own registry: STRING, version 0."
x-kurkik:
pulsar:
message:
schemaType: STRING
schemaVersion: 0
schemaIdLocation: metadata
schemaLookupStrategy: topic
schemaCompatibility: FULL
key:
type: string
bindings:
pulsar:
bindingVersion: 0.1.0
namespace: orders
persistence: persistent
x-kurkik:
pulsar:
channel:
topic: persistent://shop/orders/enriched
tenant: shop
namespace: orders
persistence: persistent
partitions: 0
geo-replication:
- standalone
topicConfiguration:
partitions: 0
persistence: persistent
replication-clusters:
- standalone
schema-autoupdate: "on"
persistent-shop-orders-normalised:
address: persistent://shop/orders/normalised
messages:
persistent-shop-orders-normalised:
payload:
type: string
name: persistent-shop-orders-normalised
title: persistent://shop/orders/normalised
summary: "Schema read from Pulsar's own registry: STRING, version 0."
x-kurkik:
pulsar:
message:
schemaType: STRING
schemaVersion: 0
schemaIdLocation: metadata
schemaLookupStrategy: topic
schemaCompatibility: FULL
key:
type: string
bindings:
pulsar:
bindingVersion: 0.1.0
namespace: orders
persistence: persistent
x-kurkik:
pulsar:
channel:
topic: persistent://shop/orders/normalised
tenant: shop
namespace: orders
persistence: persistent
partitions: 0
geo-replication:
- standalone
topicConfiguration:
partitions: 0
persistence: persistent
replication-clusters:
- standalone
schema-autoupdate: "on"
persistent-shop-orders-paid:
address: persistent://shop/orders/paid
messages:
persistent-shop-orders-paid:
payload:
type: string
name: persistent-shop-orders-paid
title: persistent://shop/orders/paid
summary: "Schema read from Pulsar's own registry: STRING, version 0."
x-kurkik:
pulsar:
message:
schemaType: STRING
schemaVersion: 0
schemaIdLocation: metadata
schemaLookupStrategy: topic
schemaCompatibility: FULL
key:
type: string
bindings:
pulsar:
bindingVersion: 0.1.0
namespace: orders
persistence: persistent
x-kurkik:
pulsar:
channel:
topic: persistent://shop/orders/paid
tenant: shop
namespace: orders
persistence: persistent
partitions: 2
geo-replication:
- standalone
topicConfiguration:
partitions: 2
persistence: persistent
replication-clusters:
- standalone
schema-autoupdate: "on"
persistent-shop-orders-raw:
address: persistent://shop/orders/raw
bindings:
pulsar:
bindingVersion: 0.1.0
namespace: orders
persistence: persistent
x-kurkik:
pulsar:
channel:
topic: persistent://shop/orders/raw
tenant: shop
namespace: orders
persistence: persistent
partitions: 0
geo-replication:
- standalone
topicConfiguration:
partitions: 0
persistence: persistent
replication-clusters:
- standalone
schema-autoupdate: "on"
operations:
receive_persistent-shop-orders-created:
action: receive
channel:
$ref: "#/channels/persistent-shop-orders-created"
x-kurkik:
pulsar:
operation:
groupId:
type: string
enum:
- enrich
security: []
processors:
- type: function
name: shop/orders/enrich
server: standalone
consumerConfiguration: {}
receive_persistent-shop-orders-enriched:
action: receive
channel:
$ref: "#/channels/persistent-shop-orders-enriched"
x-kurkik:
pulsar:
operation:
security: []
consumerConfiguration: {}
receive_persistent-shop-orders-normalised:
action: receive
channel:
$ref: "#/channels/persistent-shop-orders-normalised"
x-kurkik:
pulsar:
operation:
security: []
consumerConfiguration: {}
receive_persistent-shop-orders-paid:
action: receive
channel:
$ref: "#/channels/persistent-shop-orders-paid"
x-kurkik:
pulsar:
operation:
groupId:
type: string
enum:
- normalise
security: []
processors:
- type: function
name: shop/orders/normalise
server: standalone
consumerConfiguration: {}
receive_persistent-shop-orders-raw:
action: receive
channel:
$ref: "#/channels/persistent-shop-orders-raw"
x-kurkik:
pulsar:
operation:
security: []
consumerConfiguration: {}
send_persistent-shop-orders-created:
action: send
channel:
$ref: "#/channels/persistent-shop-orders-created"
x-kurkik:
pulsar:
operation:
security: []
producerConfiguration: {}
send_persistent-shop-orders-enriched:
action: send
channel:
$ref: "#/channels/persistent-shop-orders-enriched"
x-kurkik:
pulsar:
operation:
security: []
processors:
- type: function
name: shop/orders/enrich
server: standalone
producerConfiguration: {}
send_persistent-shop-orders-normalised:
action: send
channel:
$ref: "#/channels/persistent-shop-orders-normalised"
x-kurkik:
pulsar:
operation:
security: []
processors:
- type: function
name: shop/orders/normalise
server: standalone
producerConfiguration: {}
send_persistent-shop-orders-paid:
action: send
channel:
$ref: "#/channels/persistent-shop-orders-paid"
x-kurkik:
pulsar:
operation:
security: []
producerConfiguration: {}
send_persistent-shop-orders-raw:
action: send
channel:
$ref: "#/channels/persistent-shop-orders-raw"
x-kurkik:
pulsar:
operation:
security: []
producerConfiguration: {}

Download source.yaml

target.yaml, 415 lines
asyncapi: 3.0.0
info:
title: b Apache Pulsar API
version: 1.0.0-SNAPSHOT
description: Generated by reading Apache Pulsar of b (http://pulsar-b:8080).
servers:
standalone:
host: pulsar-b:6650
protocol: pulsar
protocolVersion: "4.0"
description: Apache Pulsar cluster standalone.
bindings:
pulsar:
bindingVersion: 0.1.0
tenant: shop
x-kurkik:
pulsar:
server:
cluster: standalone
brokers:
- localhost:8080
schemaRegistryUrl: http://pulsar-b:8080
schemaRegistryVendor: pulsar
namespacePolicies:
public/default:
schema-autoupdate: "on"
shop/orders:
schema-autoupdate: "on"
tenants:
- tenant: public
adminRoles: []
allowedClusters:
- standalone
- tenant: shop
adminRoles:
- shop-admin
allowedClusters:
- standalone
security:
- security: NONE
tls: false
acl: []
consumers:
- subscription: enrich
type: Shared
topics:
- persistent://shop/orders/created
processor: function shop/orders/enrich
- subscription: tidy
type: Shared
topics:
- persistent://shop/orders/raw
processor: function shop/orders/tidy
producers: []
functions:
- tenant: shop
namespace: orders
name: enrich
runtime: JAVA
className: com.github.pakisan.kurkik.pulsar.fixtures.Enrich
inputs:
- persistent://shop/orders/created
output: persistent://shop/orders/enriched
subscriptionName: enrich
parallelism: 2
processingGuarantees: ATLEAST_ONCE
channels:
- $ref: "#/channels/persistent-shop-orders-created"
- $ref: "#/channels/persistent-shop-orders-enriched"
roles: []
- tenant: shop
namespace: orders
name: tidy
runtime: JAVA
className: com.github.pakisan.kurkik.pulsar.fixtures.Normalise
inputs:
- persistent://shop/orders/raw
output: persistent://shop/orders/normalised
subscriptionName: tidy
parallelism: 1
processingGuarantees: ATLEAST_ONCE
channels:
- $ref: "#/channels/persistent-shop-orders-raw"
- $ref: "#/channels/persistent-shop-orders-normalised"
roles: []
sources: []
sinks: []
brokerConfiguration:
advertisedAddress: localhost
backlogQuotaDefaultLimitGB: "10.0"
bookkeeperClientMinNumRacksPerWriteQuorum: "1"
bookkeeperClientReorderReadSequenceEnabled: "false"
bookkeeperNumberOfChannelsPerBookie: "1"
brokerDeleteInactiveTopicsEnabled: "false"
clusterName: standalone
enablePackagesManagement: "true"
forceDeleteNamespaceAllowed: "true"
functionsWorkerEnablePackageManagement: "true"
isRunningStandalone: "true"
loadBalancerEnabled: "false"
loadManagerClassName: org.apache.pulsar.broker.loadbalance.NoopLoadManager
managedLedgerCacheEvictionFrequency: "100.0"
managedLedgerDefaultAckQuorum: "1"
managedLedgerDefaultEnsembleSize: "1"
managedLedgerDefaultMarkDeleteRateLimit: "0.1"
managedLedgerDefaultWriteQuorum: "1"
metadataStoreUrl: rocksdb:///pulsar/data/metadata
packagesManagementStorageProvider: org.apache.pulsar.packages.management.storage.filesystem.FileSystemPackagesStorageProvider
statusFilePath: /usr/local/apache/htdocs
topicPublisherThrottlingTickTimeMillis: "2"
webSocketServiceEnabled: "true"
clientConfiguration:
serviceUrl: pulsar://pulsar-b:6650
webServiceUrl: http://pulsar-b:8080
producerConfiguration: {}
consumerConfiguration: {}
channels:
persistent-shop-orders-created:
address: persistent://shop/orders/created
messages:
persistent-shop-orders-created:
payload:
type: string
name: persistent-shop-orders-created
title: persistent://shop/orders/created
summary: "Schema read from Pulsar's own registry: STRING, version 0."
x-kurkik:
pulsar:
message:
schemaType: STRING
schemaVersion: 0
schemaIdLocation: metadata
schemaLookupStrategy: topic
schemaCompatibility: FULL
key:
type: string
bindings:
pulsar:
bindingVersion: 0.1.0
namespace: orders
persistence: persistent
x-kurkik:
pulsar:
channel:
topic: persistent://shop/orders/created
tenant: shop
namespace: orders
persistence: persistent
partitions: 0
geo-replication:
- standalone
topicConfiguration:
partitions: 0
persistence: persistent
replication-clusters:
- standalone
schema-autoupdate: "on"
persistent-shop-orders-enriched:
address: persistent://shop/orders/enriched
messages:
persistent-shop-orders-enriched:
payload:
type: string
name: persistent-shop-orders-enriched
title: persistent://shop/orders/enriched
summary: "Schema read from Pulsar's own registry: STRING, version 0."
x-kurkik:
pulsar:
message:
schemaType: STRING
schemaVersion: 0
schemaIdLocation: metadata
schemaLookupStrategy: topic
schemaCompatibility: FULL
key:
type: string
bindings:
pulsar:
bindingVersion: 0.1.0
namespace: orders
persistence: persistent
x-kurkik:
pulsar:
channel:
topic: persistent://shop/orders/enriched
tenant: shop
namespace: orders
persistence: persistent
partitions: 0
geo-replication:
- standalone
topicConfiguration:
partitions: 0
persistence: persistent
replication-clusters:
- standalone
schema-autoupdate: "on"
persistent-shop-orders-normalised:
address: persistent://shop/orders/normalised
messages:
persistent-shop-orders-normalised:
payload:
type: string
name: persistent-shop-orders-normalised
title: persistent://shop/orders/normalised
summary: "Schema read from Pulsar's own registry: STRING, version 0."
x-kurkik:
pulsar:
message:
schemaType: STRING
schemaVersion: 0
schemaIdLocation: metadata
schemaLookupStrategy: topic
schemaCompatibility: FULL
key:
type: string
bindings:
pulsar:
bindingVersion: 0.1.0
namespace: orders
persistence: persistent
x-kurkik:
pulsar:
channel:
topic: persistent://shop/orders/normalised
tenant: shop
namespace: orders
persistence: persistent
partitions: 0
geo-replication:
- standalone
topicConfiguration:
partitions: 0
persistence: persistent
replication-clusters:
- standalone
schema-autoupdate: "on"
persistent-shop-orders-paid:
address: persistent://shop/orders/paid
bindings:
pulsar:
bindingVersion: 0.1.0
namespace: orders
persistence: persistent
x-kurkik:
pulsar:
channel:
topic: persistent://shop/orders/paid
tenant: shop
namespace: orders
persistence: persistent
partitions: 2
geo-replication:
- standalone
topicConfiguration:
partitions: 2
persistence: persistent
replication-clusters:
- standalone
schema-autoupdate: "on"
persistent-shop-orders-raw:
address: persistent://shop/orders/raw
messages:
persistent-shop-orders-raw:
payload:
type: string
name: persistent-shop-orders-raw
title: persistent://shop/orders/raw
summary: "Schema read from Pulsar's own registry: STRING, version 0."
x-kurkik:
pulsar:
message:
schemaType: STRING
schemaVersion: 0
schemaIdLocation: metadata
schemaLookupStrategy: topic
schemaCompatibility: FULL
key:
type: string
bindings:
pulsar:
bindingVersion: 0.1.0
namespace: orders
persistence: persistent
x-kurkik:
pulsar:
channel:
topic: persistent://shop/orders/raw
tenant: shop
namespace: orders
persistence: persistent
partitions: 0
geo-replication:
- standalone
topicConfiguration:
partitions: 0
persistence: persistent
replication-clusters:
- standalone
schema-autoupdate: "on"
operations:
receive_persistent-shop-orders-created:
action: receive
channel:
$ref: "#/channels/persistent-shop-orders-created"
x-kurkik:
pulsar:
operation:
groupId:
type: string
enum:
- enrich
security: []
processors:
- type: function
name: shop/orders/enrich
server: standalone
consumerConfiguration: {}
receive_persistent-shop-orders-enriched:
action: receive
channel:
$ref: "#/channels/persistent-shop-orders-enriched"
x-kurkik:
pulsar:
operation:
security: []
consumerConfiguration: {}
receive_persistent-shop-orders-normalised:
action: receive
channel:
$ref: "#/channels/persistent-shop-orders-normalised"
x-kurkik:
pulsar:
operation:
security: []
consumerConfiguration: {}
receive_persistent-shop-orders-paid:
action: receive
channel:
$ref: "#/channels/persistent-shop-orders-paid"
x-kurkik:
pulsar:
operation:
security: []
consumerConfiguration: {}
receive_persistent-shop-orders-raw:
action: receive
channel:
$ref: "#/channels/persistent-shop-orders-raw"
x-kurkik:
pulsar:
operation:
groupId:
type: string
enum:
- tidy
security: []
processors:
- type: function
name: shop/orders/tidy
server: standalone
consumerConfiguration: {}
send_persistent-shop-orders-created:
action: send
channel:
$ref: "#/channels/persistent-shop-orders-created"
x-kurkik:
pulsar:
operation:
security: []
producerConfiguration: {}
send_persistent-shop-orders-enriched:
action: send
channel:
$ref: "#/channels/persistent-shop-orders-enriched"
x-kurkik:
pulsar:
operation:
security: []
processors:
- type: function
name: shop/orders/enrich
server: standalone
producerConfiguration: {}
send_persistent-shop-orders-normalised:
action: send
channel:
$ref: "#/channels/persistent-shop-orders-normalised"
x-kurkik:
pulsar:
operation:
security: []
processors:
- type: function
name: shop/orders/tidy
server: standalone
producerConfiguration: {}
send_persistent-shop-orders-paid:
action: send
channel:
$ref: "#/channels/persistent-shop-orders-paid"
x-kurkik:
pulsar:
operation:
security: []
producerConfiguration: {}
send_persistent-shop-orders-raw:
action: send
channel:
$ref: "#/channels/persistent-shop-orders-raw"
x-kurkik:
pulsar:
operation:
security: []
producerConfiguration: {}

Download target.yaml

How to build this setup yourself

Clusters

Pulsar a

Terminal window
pulsar-admin --admin-url http://pulsar-a:8080 tenants create shop --allowed-clusters standalone --admin-roles shop-admin
pulsar-admin --admin-url http://pulsar-a:8080 namespaces create shop/orders --clusters standalone
pulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/created
pulsar-admin --admin-url http://pulsar-a:8080 topics create-partitioned-topic persistent://shop/orders/paid --partitions 2
pulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/enriched
pulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/normalised
pulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/raw
pulsar-admin --admin-url http://pulsar-a:8080 packages upload function://shop/orders/enrich@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-a:8080 functions create --tenant shop --namespace orders --name enrich --jar function://shop/orders/enrich@0 --classname com.github.pakisan.kurkik.pulsar.fixtures.Enrich --inputs persistent://shop/orders/created --output persistent://shop/orders/enriched --subs-name enrich --parallelism 1
pulsar-admin --admin-url http://pulsar-a:8080 packages upload function://shop/orders/normalise@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-a:8080 functions create --tenant shop --namespace orders --name normalise --jar function://shop/orders/normalise@0 --classname com.github.pakisan.kurkik.pulsar.fixtures.Normalise --inputs persistent://shop/orders/paid --output persistent://shop/orders/normalised --subs-name normalise --parallelism 1

Pulsar b

Terminal window
pulsar-admin --admin-url http://pulsar-b:8080 tenants create shop --allowed-clusters standalone --admin-roles shop-admin
pulsar-admin --admin-url http://pulsar-b:8080 namespaces create shop/orders --clusters standalone
pulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/created
pulsar-admin --admin-url http://pulsar-b:8080 topics create-partitioned-topic persistent://shop/orders/paid --partitions 2
pulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/enriched
pulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/normalised
pulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/raw
pulsar-admin --admin-url http://pulsar-b:8080 packages upload function://shop/orders/normalise@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-b:8080 packages upload function://shop/orders/enrich@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-b:8080 functions create --tenant shop --namespace orders --name enrich --jar function://shop/orders/enrich@0 --classname com.github.pakisan.kurkik.pulsar.fixtures.Enrich --inputs persistent://shop/orders/created --output persistent://shop/orders/enriched --subs-name enrich --parallelism 2
pulsar-admin --admin-url http://pulsar-b:8080 packages upload function://shop/orders/tidy@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-b:8080 functions create --tenant shop --namespace orders --name tidy --jar function://shop/orders/tidy@0 --classname com.github.pakisan.kurkik.pulsar.fixtures.Normalise --inputs persistent://shop/orders/raw --output persistent://shop/orders/normalised --subs-name tidy --parallelism 1

Sync

Terminal window
kurkik conn add pulsar a --admin-url http://pulsar-a:8080 --service-url pulsar://pulsar-a:6650 --client 4.0
kurkik conn add pulsar b --admin-url http://pulsar-b:8080 --service-url pulsar://pulsar-b:6650 --client 4.0
kurkik pulsar export a --this-cluster-only --acls --consumers --stdout \
--package function:shop/orders/enrich=function://shop/orders/enrich@0 \
--package function:shop/orders/normalise=function://shop/orders/normalise@0 > a.yaml # source.yaml (and b's, before: target.yaml)
# --package: the package each function, source or sink runs, as the build that published it knows - Pulsar's admin API
# never says which package a processor was deployed from, so the export is told
kurkik pulsar sync a.yaml b --functions --dry-run # plan-without.txt
kurkik pulsar sync a.yaml b --functions --overwrite --delete --dry-run # plan.txt (and -o json: plan.json)
kurkik pulsar sync a.yaml b --functions --overwrite --delete --yes # apply.txt, and the reverse patch: rollback.yaml
kurkik pulsar diff a.yaml b --functions # after.txt
kurkik pulsar sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml b --force --yes # revert.txt

Same plan.

How to build this setup yourself

Clusters

Pulsar a

Terminal window
pulsar-admin --admin-url http://pulsar-a:8080 tenants create shop --allowed-clusters standalone --admin-roles shop-admin
pulsar-admin --admin-url http://pulsar-a:8080 namespaces create shop/orders --clusters standalone
pulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/created
pulsar-admin --admin-url http://pulsar-a:8080 topics create-partitioned-topic persistent://shop/orders/paid --partitions 2
pulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/enriched
pulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/normalised
pulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/raw
pulsar-admin --admin-url http://pulsar-a:8080 packages upload function://shop/orders/enrich@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-a:8080 functions create --tenant shop --namespace orders --name enrich --jar function://shop/orders/enrich@0 --classname com.github.pakisan.kurkik.pulsar.fixtures.Enrich --inputs persistent://shop/orders/created --output persistent://shop/orders/enriched --subs-name enrich --parallelism 1
pulsar-admin --admin-url http://pulsar-a:8080 packages upload function://shop/orders/normalise@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-a:8080 functions create --tenant shop --namespace orders --name normalise --jar function://shop/orders/normalise@0 --classname com.github.pakisan.kurkik.pulsar.fixtures.Normalise --inputs persistent://shop/orders/paid --output persistent://shop/orders/normalised --subs-name normalise --parallelism 1

Pulsar b

Terminal window
pulsar-admin --admin-url http://pulsar-b:8080 tenants create shop --allowed-clusters standalone --admin-roles shop-admin
pulsar-admin --admin-url http://pulsar-b:8080 namespaces create shop/orders --clusters standalone
pulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/created
pulsar-admin --admin-url http://pulsar-b:8080 topics create-partitioned-topic persistent://shop/orders/paid --partitions 2
pulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/enriched
pulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/normalised
pulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/raw
pulsar-admin --admin-url http://pulsar-b:8080 packages upload function://shop/orders/normalise@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-b:8080 packages upload function://shop/orders/enrich@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-b:8080 functions create --tenant shop --namespace orders --name enrich --jar function://shop/orders/enrich@0 --classname com.github.pakisan.kurkik.pulsar.fixtures.Enrich --inputs persistent://shop/orders/created --output persistent://shop/orders/enriched --subs-name enrich --parallelism 2
pulsar-admin --admin-url http://pulsar-b:8080 packages upload function://shop/orders/tidy@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-b:8080 functions create --tenant shop --namespace orders --name tidy --jar function://shop/orders/tidy@0 --classname com.github.pakisan.kurkik.pulsar.fixtures.Normalise --inputs persistent://shop/orders/raw --output persistent://shop/orders/normalised --subs-name tidy --parallelism 1

Sync

Terminal window
kurkik conn add pulsar a --admin-url http://pulsar-a:8080 --service-url pulsar://pulsar-a:6650 --client 4.0
kurkik conn add pulsar b --admin-url http://pulsar-b:8080 --service-url pulsar://pulsar-b:6650 --client 4.0
kurkik pulsar export a --this-cluster-only --acls --consumers --stdout \
--package function:shop/orders/enrich=function://shop/orders/enrich@0 \
--package function:shop/orders/normalise=function://shop/orders/normalise@0 > a.yaml # source.yaml (and b's, before: target.yaml)
# --package: the package each function, source or sink runs, as the build that published it knows - Pulsar's admin API
# never says which package a processor was deployed from, so the export is told
kurkik pulsar sync a.yaml b --functions --dry-run # plan-without.txt
kurkik pulsar sync a.yaml b --functions --overwrite --delete --dry-run # plan.txt (and -o json: plan.json)
kurkik pulsar sync a.yaml b --functions --overwrite --delete --yes # apply.txt, and the reverse patch: rollback.yaml
kurkik pulsar diff a.yaml b --functions # after.txt
kurkik pulsar sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml b --force --yes # revert.txt

Same plan.

How to build this setup yourself

Clusters

Pulsar a

Terminal window
pulsar-admin --admin-url http://pulsar-a:8080 tenants create shop --allowed-clusters standalone --admin-roles shop-admin
pulsar-admin --admin-url http://pulsar-a:8080 namespaces create shop/orders --clusters standalone
pulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/created
pulsar-admin --admin-url http://pulsar-a:8080 topics create-partitioned-topic persistent://shop/orders/paid --partitions 2
pulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/enriched
pulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/normalised
pulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/raw
pulsar-admin --admin-url http://pulsar-a:8080 packages upload function://shop/orders/enrich@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-a:8080 functions create --tenant shop --namespace orders --name enrich --jar function://shop/orders/enrich@0 --classname com.github.pakisan.kurkik.pulsar.fixtures.Enrich --inputs persistent://shop/orders/created --output persistent://shop/orders/enriched --subs-name enrich --parallelism 1
pulsar-admin --admin-url http://pulsar-a:8080 packages upload function://shop/orders/normalise@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-a:8080 functions create --tenant shop --namespace orders --name normalise --jar function://shop/orders/normalise@0 --classname com.github.pakisan.kurkik.pulsar.fixtures.Normalise --inputs persistent://shop/orders/paid --output persistent://shop/orders/normalised --subs-name normalise --parallelism 1

Pulsar b

Terminal window
pulsar-admin --admin-url http://pulsar-b:8080 tenants create shop --allowed-clusters standalone --admin-roles shop-admin
pulsar-admin --admin-url http://pulsar-b:8080 namespaces create shop/orders --clusters standalone
pulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/created
pulsar-admin --admin-url http://pulsar-b:8080 topics create-partitioned-topic persistent://shop/orders/paid --partitions 2
pulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/enriched
pulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/normalised
pulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/raw
pulsar-admin --admin-url http://pulsar-b:8080 packages upload function://shop/orders/normalise@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-b:8080 packages upload function://shop/orders/enrich@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-b:8080 functions create --tenant shop --namespace orders --name enrich --jar function://shop/orders/enrich@0 --classname com.github.pakisan.kurkik.pulsar.fixtures.Enrich --inputs persistent://shop/orders/created --output persistent://shop/orders/enriched --subs-name enrich --parallelism 2
pulsar-admin --admin-url http://pulsar-b:8080 packages upload function://shop/orders/tidy@0 --path kurkik-pulsar-processors.jar --description 'kurkik fixtures'
pulsar-admin --admin-url http://pulsar-b:8080 functions create --tenant shop --namespace orders --name tidy --jar function://shop/orders/tidy@0 --classname com.github.pakisan.kurkik.pulsar.fixtures.Normalise --inputs persistent://shop/orders/raw --output persistent://shop/orders/normalised --subs-name tidy --parallelism 1

Sync

Terminal window
kurkik conn add pulsar a --admin-url http://pulsar-a:8080 --service-url pulsar://pulsar-a:6650 --client 4.0
kurkik conn add pulsar b --admin-url http://pulsar-b:8080 --service-url pulsar://pulsar-b:6650 --client 4.0
kurkik pulsar export a --this-cluster-only --acls --consumers --stdout \
--package function:shop/orders/enrich=function://shop/orders/enrich@0 \
--package function:shop/orders/normalise=function://shop/orders/normalise@0 > a.yaml # source.yaml (and b's, before: target.yaml)
# --package: the package each function, source or sink runs, as the build that published it knows - Pulsar's admin API
# never says which package a processor was deployed from, so the export is told
kurkik pulsar sync a.yaml b --functions --dry-run # plan-without.txt
kurkik pulsar sync a.yaml b --functions --overwrite --delete --dry-run # plan.txt (and -o json: plan.json)
kurkik pulsar sync a.yaml b --functions --overwrite --delete --yes # apply.txt, and the reverse patch: rollback.yaml
kurkik pulsar diff a.yaml b --functions # after.txt
kurkik pulsar sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml b --force --yes # revert.txt

All flags: kurkik pulsar sync · more Apache Pulsar sync examples