Skip to main content
Loading

Configuration for Routing of Pulsar Outbound

Routing

The routing section controls how Aerospike records are routed to a Pulsar destination. The following routing modes are available.

  • static: Always route to a static topic.
  • skip Skip dispatch of record to Pulsar and ack success to XDR.
  • namespace: Use the namespace of the Aerospike record as the Pulsar topic.
  • set: Use the set of the Aerospike record as the Pulsar topic.
  • bin: Sets the route based on the value of a bin in the record. Only string, blob and integer bin types are supported.
  • custom Route with custom code.
note

You have to specify the persistence nature of the pulsar topic in the configuration along with the topic name. For example, if you want to use a non-persistent topic my-topic, then you have to configure non-persistent://public/default/my-topic in the configuration. If you just specify my-topic, it will create/use persistent://public/default/my-topic. Namespace and tenant can also be specified in this topic URL

Static routing

For static routing the configuration options are:

OptionRequiredExpected valueDescription
modeyesstaticSelects static routing configuration.
destinationyesThe name of the destination Pulsar topic.

Example

routing:
mode: static
destination: pulsar-topic

Skip routing

For skip routing the configuration options are

OptionRequiredExpected valueDescription
modeyesskipSkip dispatch of record to Pulsar and ack success to XDR.

Example

routing:
mode: skip

Set name routing

For record set name routing the configuration options are:

OptionRequiredExpected valueDescription
modeyessetSelects set name routing configuration.
defaultnoThe default destination topic to use in case the set name is missing in the record or the destination topic is not found.
transformsnoList of transformations to apply to the set name. See transforms section for details.

Example

routing:
mode: set
transforms:
- trim
- regex:
pattern: '(.*):(.*)'
replacement: '$2:$1'
- regex:
pattern: '$'
replacement: ':please'
- uppercase

Namespace name routing

For record namespace name routing the configuration options are:

OptionRequiredExpected valueDescription
modeyesnamespaceSelects namespace name routing configuration.
defaultnoThe default destination topic to use in case the namespace name is missing in the record or the destination topic is not found.
transformsnoList of transformations to apply to the namespace name. See transforms section for details.

Example

routing:
mode: namespace
default: default-topic
transforms:
- trim
- regex:
pattern: '(.*):(.*)'
replacement: '$2:$1'
- regex:
pattern: '$'
replacement: ':please'
- uppercase

Bin value routing

For bin based routing the configuration options are:

OptionRequiredExpected valueDescription
modeyesbinSelects bin based routing.
binyesThe name of the bin to pick value from.
defaultyesThe default destination topic to use in case the bin is missing in the record or the destination topic is not found.
transformsnoList of transformations to apply to the bin value. See transforms section for details.

Example

routing:
mode: bin
bin: category
default: test-topic
transforms:
- trim
- regex:
pattern: '[^A-Za-z0-9]'
replacement: '-'
- lowercase

Custom Routing

Record can be also be routed with custom code. See Routing Transform.

Example

routing:
mode: custom
class: com.aerospike.connect.outbound.example.GenerationRouter

Transforms

You can configure a list of transforms that will be applied, in order, to the record's set name, namespace path or bin value in order to derive the destination topic.

Currently, the following transforms are supported:

  • lowercase - converts the bin value to lowercase.
  • uppercase - converts the bin value to uppercase.
  • trim - trim leading and trailing whitespace.
  • regex - match against a regex pattern and replace all occurrences with a replacement. The regex and replacement uses Java regex syntax.

Example

The following transform configuration will first trim the route, replace all non-alphanumeric characters with '-' and convert the result to lowercase.

routing:
mode: bin
bin: category
default: test-topic
transforms:
- trim
- regex:
pattern: '[^A-Za-z0-9]'
replacement: '-'
- lowercase