Configure streaming from Aerospike to JMS
Configuring streaming from Aerospike to JMS involves setting up your Aerospike database to send change notifications and modifying the configuration file for the JMS outbound connector: /etc/aerospike-jms-outbound/aerospike-jms-outbound.yml. “Outbound” means that the connector receives change notifications from Aerospike, translates them into JSON messages, and places the messages on topics or queues in a JMS message broker. This file is located on the system where you installed the connector package.
Setting Up Aerospike Database
In your Aerospike database, you must configure Cross-Datacenter Replication (XDR) and enable change notification. You must also configure your JMS cluster to be a “connector” XDR datacenter and the namespace must point to this as xdr remote datacenter. [//]: # (Questions:) [//]: # (1. Namespace for what?) [//]: # (2. Is “xdr remote datacenter” the actual name?) [//]: # (3. How does a namespace “point” to anything?)
See the change notification configuration parameters and example config.
Modifying aerospike-jms-outbound.yml
You configure streaming from Aerospike to JMS by modifying the /etc/aerospike-jms-outbound/aerospike-jms-outbound.yml YAML configuration file.
[//]: # (What filesystem is this file located in? on the system where you installed the client package. no guidelines yet for provisioning. You can run more than one connector, definitely want to run more than one.)
The configuration file has the following sections:
serviceConfigures the connector’s listening ports, TLS, and network interface.jmsConfigures connection properties for the target JMS message broker.bin-transformsSpecifies the bin transformations to apply on the Aerospike record.formatSpecifies the message format to use for the outbound messages sent to the message broker.batchingSpecifies how to collect a group of Change Notification Records into a single batch of outbound messages sent to the message broker.delivery-modeChooses between persistent and non-persistent delivery of messages to the message broker.routingConfigures how incoming record updates/deletes from Aerospike are routed to the message broker.namespacesConfigures bin transforms, format, routing at namespace and set level.loggingConfigures the destination and level for the connectors logs.
Cascading Configuration Values
You can configure the bin-transforms, format, and routing sections to include default values, values for each particular namespace, and values for each particular set within a namespace. For each Aerospike record, the appropriate values are applied.
Here is an annotated example:
routing: mode: static destination: default <1>namespaces: users: routing: mode: static destination: users <2> format: mode: flat-json metadata-key: metadata sets: premium: routing: mode: static destination: premium <3>- Specifies that records in all namespaces are to be shipped to the
defaulttopic. - Specifies that records in the
usersnamespace are to be shipped to theuserstopic. - Specifies that records in the
premiumset in theusersnamespace are to be shipped to thepremiumtopic.
Example
A sample version of /etc/aerospike-jms-outbound/aerospike-jms-outbound.yml for connecting to IBM MQ is shown below:
service: port: 8080
logging: file: /var/log/aerospike-jms-outbound/aerospike-jms-outbound.log
jms: factory: com.ibm.mq.jms.MQConnectionFactory spec: 2.0 config: hostName: 10.0.2.5 port: 1414 queueManager: QM1 transportType: 1 channel: DEV.APP.SVRCONN credentials: username: admin password-file: /path/to/password/file.txt
delivery-mode: persistent
format: json
bin-transforms: map: yellow: red transforms: - uppercase
routing: mode: bin type: queue bin: category default: test-queue transforms: - trim - regex: pattern: '[^A-Za-z0-9]' replacement: '-' - lowercase
namespaces: users: routing: mode: static type: queue destination: users format: mode: flat-json metadata-key: metadata sets: premium: routing: mode: static type: queue destination: premium bin-transforms: map: gold: platinum