Update queue - JMS
The Genesis platform enables you to use a Jakarta Messaging (former JMS) compliant message broker as its real-time update-queue back-end via ArtemisMQ.
Using a centralised external broker is highly recommended for complex, large or dynamically scaled clusters, as it reduces the complexity and overhead of peer-to-peer connectivity at the cost of maintaining or (re-using) a message broker.
Prerequisites
To use Genesis Jakarta Messaging on the platform, you must install ArtemisMQ in the host (or hosts in case of High Availability). This is described in the ArtemisMQ documentation.
Genesis does not ship Artemis MQ server, just its client library.
JMS configuration options
Basic configuration
To use Jakarta Messaging in your Genesis application, set the MqLayer
in your application's system definition file.
systemDefinition {
global {
...
item(name = "MqLayer", value = "JMS")
...
}
}
The Config variables are listed below.
Config Item | Description | Default |
---|---|---|
JmsHost (required) | The host name, can hold multiple values separated by comma; this enables you to use HA failover | http://localhost:61616 |
JmsUsername | Username to connect | |
JmsPassword | Password to connect (can be encrypted using GenesisKey ) | |
JmsTopicSubscriptionMode | Enum value (TRANSIENT, PERSISTENT) | TRANSIENT |
JmsMaxConnectionRetryOnStartup | The number of connections the process will attempt to make to the broker before declaring the process DOWN | 20 |
JmsReconnectDelayMs | The amount of time in milliseconds (exponentially) for a connection reattempt to be made, in case of connectivity problems or other faults | 1000 |
JmsRetryToSendDelayMs | The amount of time in milliseconds for retrying to send a message in case of failure. | 1000 |
Durable consumers
You can configure specific processes to receive messages that were sent when the process was offline. This offers a useful method for processes to recover from missing messages without the need to replay an entire data stream.
For example, assume you have an application named alpha
and you are going to set up ALPHA_CONSOLIDATOR
to be a durable consumer of the update queue.
- Create a configuration file for the
ALPHA_CONSOLIDATOR
process with the contents:
process {
systemDefinition {
item(name = "JmsTopicSubscriptionMode", value = "PERSISTENT")
}
}
- Add the details of the newly created configuration to your application's processes.xml file:
<process name="ALPHA_CONSOLIDATOR">
<groupId>ALPHA</groupId>
<start>true</start>
<options>-Xmx256m -DRedirectStreamsToLog=true -DXSD_VALIDATE=false -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5106</options>
<module>genesis-pal-consolidator</module>
<package>global.genesis.pal.consolidator</package>
<script>alpha-consolidator.kts</script>
<config>alpha-consolidator-process-config.kts</config>
<language>pal</language>
<primaryOnly>true</primaryOnly>
</process>
- Perform
genesisInstall
to apply the configuration and start the processes normally.
Do not define JmsTopicSubscriptionMode
at Global level, as this will cause all messages to be stored and delivered once the process is back online.