Integrating the gateway with Apache Pulsar
The Message Bus 2 Gateway can be configured as a Pulsar producer to send messages to the Pulsar broker.
The Message Bus 2 Gateway connects to Apache Pulsar using the Pulsar transport.
Configuring the Message Bus 2 Gateway to exchange messages with Apache Pulsar
The following configuration files are supplied with the gateway for the integration with Apache Pulsar:
- G_MESSAGE_BUS.props
- pulsarTransport.properties
- pulsarConnectionProperties.json
- pulsarClient.properties
- pulsarProducer.properties
To configure the Message Bus 2 Gateway to publish Apache Pulsar events, use the following steps:
- Install/update the Message Bus 2 Gateway. See Installing the gateway.
- Edit the gateway configuration in the following gateway properties
file:
$OMNIHOME/etc/G_MESSAGE_BUS.props
- Update the following property values with the appropriate
path:
Gate.MsgBus.TransportFile : '$OMNIHOME/java/conf/pulsarTransport.properties' Gate.MsgBus.TransportType : 'PULSAR' - Configure the Pulsar transport properties.
- Edit the Pulsar transport configuration in the following transport properties
file:
$OMNIHOME/java/conf/pulsarTransport.properties
- Update the following property value with the appropriate
path:
PulsarClientMode=PRODUCER connectionPropertiesFile=$OMNIHOME/java/conf/pulsarConnectionProperties.json
- Edit the Pulsar transport configuration in the following transport properties
file:
- For descriptions of the Pulsar transport properties, see the The pulsarTransport.properties file.
- Update the paths of the
pulsarClient.properties,pulsarConsumer.properties, andpulsarProducer.propertiesfiles. The paths of these properties files are specified in the following JSON file:$OMNIHOME/java/conf/pulsarConnectionProperties.json
Note: The location ofpulsarConnectionProperties.jsonis specified inpulsarTransport.properties. - Uncomment and populate the following fields in the pulsarClient.properties
file to connect to the Pulsar client.
# Service URL provider for Pulsar service # serviceUrl=pulsar://localhost:6650 # Name of the authentication plugin # authPluginClassName= # String represents parameters for the authentication plugin. Example key1:val1,key2:val2 # authParams= # Path to the trusted TLS certificate file # tlsTrustCertsFilePath= # Whether the Pulsar client accepts untrusted TLS certificate from broker # tlsAllowInsecureConnection=false # Whether to enable TLS hostname verification # tlsHostnameVerificationEnable=false - Uncomment and populate the following fields in the
pulsarProducer.properties file to send messages to the Pulsar broker.
# Topic name # topicName= # Producer name # producerName= # Message send timeout in ms # sendTimeoutMs= # If true, when the outgoing message queue is full, producer will be blocked, rather than failing and throwing errors # If false, when the outgoing message queue is full, producer will throw ProducerQueueIsFullError exceptions # blockIfQueueFull= # The maximum size of a queue holding pending messages # maxPendingMessages= # Enable batching of messages # batchingEnabled= # Batching time period of sending messages # batchingMaxPublishDelayMicros= # The maximum number of messages permitted in a batch # batchingMaxMessages= # Message data compression type used by a producer # compressionType=CAUTION:There is currently a known security issue about Pulsar compression. To mitigate the risk, do not use compression until the next release of the gateway. For now, leavecompressionTypecommented. - Run the gateway using the following command:
.$OMNIHOME/bin/nco_g_message_bus -propsfile $OMNIHOME/etc/G_MESSAGE_BUS.propsNote: The gateway property file must be copied over from $OMNIHOME/gates/message_bus to $OMNIHOME/etc if it is going to be run from that directory.