The routing section of aerospike-jms-outbound.yml
The routing
section of the /etc/aerospike-jms-outbound/aerospike-jms-outbound.yml
controls how Aerospike records are routed to a JMS destination. The JMS destination can either be a named queue or a topic.
The following routing modes are available.
- static Always route to a static queue/topic.
- skip Skip dispatch of record to JMS and ack success to XDR.
- namespace Use the namespace of the Aerospike record as the JMS queue/topic.
- set Use the set of the Aerospike record as the JMS queue/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.
Static routingโ
For static routing, the configuration options are:
Option | Required | Expected value | Description |
---|---|---|---|
mode | yes | static | Selects static routing configuration. |
type | yes | queue/topic | Destination type. |
destination | yes | Name of the destination queue/topic. |
Here is an example use of static routing:
routing:
mode: static
type: queue
destination: jms-queue
Skip routingโ
For skip routing the configuration options are
Option | Required | Expected value | Description |
---|---|---|---|
mode | yes | skip | Skip dispatch of record to JMS and ack success to XDR. |
Exampleโ
routing:
mode: skip
Skip routingโ
For skip routing the configuration options are
Option | Required | Expected value | Description |
---|---|---|---|
mode | yes | skip | Skip dispatch of record to JMS and ack success to XDR. |
Exampleโ
routing:
mode: skip
Set-name routingโ
For record set-name routing, the configuration options are:
Option | Required | Expected value | Description |
---|---|---|---|
mode | yes | set | Selects set name routing configuration. |
type | yes | queue/topic | Destination type. |
default | no | Default destination queue/topic to use in case the set name is missing in the record or the destination queue/topic is not found. | |
transforms | no | List of transformations to apply to the set name. See the Transforms section for details. |
Exampleโ
routing:
mode: set
type: queue
default: default-queue
transforms:
- trim
- regex:
pattern: '(.*):(.*)'
replacement: '$2:$1'
- regex:
pattern: '$'
replacement: ':please'
- uppercase
Namespace name routingโ
For record namespace name routing the configuration options are:
Option | Required | Expected value | Description |
---|---|---|---|
mode | yes | namespace | Selects namespace name routing configuration. |
type | yes | queue/topic | Destination type. |
default | no | Default destination queue/topic to use in case the namespace name is missing in the record or the destination queue/topic is not found. | |
transforms | no | List of transformations to apply to the namespace name. See the Transforms section for details. |
Exampleโ
routing:
mode: namespace
type: queue
default: default-queue
transforms:
- trim
- regex:
pattern: '(.*):(.*)'
replacement: '$2:$1'
- regex:
pattern: '$'
replacement: ':please'
- uppercase
Bin value routingโ
For bin based routing the configuration options are:
Option | Required | Expected value | Description |
---|---|---|---|
mode | yes | bin | Selects bin based routing. |
type | yes | queue/topic | Destination type. |
bin | yes | Name of the bin to pick value from. | |
default | yes | Default destination queue/topic to use in case the bin is missing in the record or the destination queue/topic is not found. | |
transforms | no | List of transformations to apply to the bin value. See the Transforms section for details. |
Exampleโ
routing:
mode: bin
type: queue
bin: category
default: test-queue
transforms:
- trim
- regex:
pattern: '[^A-Za-z0-9]'
replacement: '-'
- lowercase
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 queue or 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
type: queue
bin: category
default: test-queue
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