Message queues: JMS, AMQP, STOMP, IBM MQ#
A message queue is a post box between programs. One program puts a message in; another takes it out, now or later. Jobs can do both: tell another system "the file has arrived" by a message, or wait for a message that says "fetch the file now".
Two tasks do this: JMS, for message brokers that speak AMQP 1.0, STOMP or IBM MQ, and Kafka, for Kafka.
Which task for which broker#
| Broker | Task | Speaks |
|---|---|---|
| ActiveMQ Artemis, Amazon MQ, Azure Service Bus, Solace, RabbitMQ with its AMQP 1.0 plugin | JMS | AMQP 1.0 |
| ActiveMQ, RabbitMQ and others with STOMP | JMS | STOMP, directly or inside a WebSocket |
| IBM MQ | JMS | IBM's own protocol |
| Kafka, and services that offer the Kafka protocol | Kafka | Kafka |
How the JMS task knows the broker#
The JMS task has one field for the connection, JNDI Config: lines of name=value. What is in it decides which kind of broker is meant:
| The config has | The task uses |
|---|---|
provider=ibmmq |
IBM MQ |
java.naming.factory.initial=org.apache.qpid.jms.jndi.JmsInitialContextFactory |
AMQP 1.0 |
url=stomp://… or url=stomp+ssl://… |
STOMP |
url=stomp+ws://… or url=stomp+wss://… |
STOMP inside a WebSocket |
Anything else is refused: "Error: Invalid JNDI config! Could not create JMS client."
Variables work in the config. Passwords in it are masked in the job's log.
AMQP 1.0#
java.naming.factory.initial=org.apache.qpid.jms.jndi.JmsInitialContextFactory
connectionfactory.qpidConnectionfactory=amqps://broker.example.com:5671
username=jobs
password=…
queue.orders=orders
| Broker | The address |
|---|---|
| Artemis | amqps://broker.example.com:5671 |
| Amazon MQ | amqps://<broker-id>.mq.<region>.amazonaws.com:5671 |
| Azure Service Bus | amqps://<namespace>.servicebus.windows.net:5671, with the name of a shared access policy as the user and its key as the password |
| Solace | the AMQPS address, user and password from the broker's console |
?transport.trustAll=true&transport.verifyHost=false behind the address accepts any certificate. That is for a first test only.
STOMP#
url=stomp+ssl://broker.example.com:61614
username=jobs
password=…
topic.orders=orders
heartbeat_interval=5000
| Line | Is |
|---|---|
url |
stomp+ssl:// for STOMP over TLS, stomp+wss:// for STOMP in a secure WebSocket. stomp:// and stomp+ws:// are the unencrypted forms. |
heartbeat_interval |
milliseconds between the keep-alive signals. 0: none. |
acceptAnyCert=true |
accepts any certificate. For a test. |
log_stomp_command_header=true |
writes every STOMP header into the job's log, for finding faults |
IBM MQ#
provider=ibmmq
queueManager=QM1
hostname=mq.example.com
port=1414
channel=APP.SVRCONN
username=jobs
password=…
| Line | Is | Without it |
|---|---|---|
queueManager |
the queue manager's name | |
hostname, port |
where it listens | port 1414 |
connectionNameList |
several host(port) for a queue manager with a standby |
|
channel |
the server-connection channel | SYSTEM.DEF.SVRCONN |
sslCipherSuite |
the cipher of the channel, when it uses TLS. It must match the channel's. | no TLS |
sslTrustStore, sslTrustStorePassword |
the store with the queue manager's certificate | |
sslKeyStore, sslKeyStorePassword |
the store with this server's certificate, when the channel asks for one | |
sslPeerName |
the name the queue manager's certificate must carry | |
clientId |
Ask the IBM MQ administrator for: the queue manager's name, host and port, the channel, whether it uses TLS and with which cipher, whether it wants a client certificate, the user, and the queue or topic.
Files the server needs#
The clients for AMQP and for IBM MQ are not part of CrushMFT. Their jar files go into plugins/lib in the server's folder, and the server is restarted once:
| For | Files |
|---|---|
| AMQP 1.0 | the Qpid JMS client with the files it depends on, and jakarta.jms-api |
| IBM MQ | IBM's com.ibm.mq.jakarta.client (9.3 or later), jakarta.jms-api and json. The older com.ibm.mq.allclient does not work, and the task says so when it finds it. |
| STOMP | nothing: it is built in |
| Kafka | the Kafka client with the files it depends on |
A missing file shows as an error of the task that names a class that was "not found".
Because these tasks load program code that is named in their settings, they are closed to admins with limited rights: see Who may see, change and run a job.
Sending and receiving#
The JMS task is a Producer or a Consumer:
| Producer | Consumer | |
|---|---|---|
| does | sends a message: a text you write, with variables, or the files of the list as messages | takes messages from the queue and saves each as a file |
| a typical job | Find → Copy → JMS "file {name} delivered" | JMS → the files it saved → Copy |
| limits | a file sent as a message must be under 10 MB | so many messages per run (Max messages), waiting so long for each (Read timeout) |
A consumer does not wait for ever: it takes what is there, up to its limit, and the job ends. To listen "all the time", schedule the job every minute.
Messages are for telling, not for carrying: send the file by SFTP or HTTPS and a message that says where it is.
Testing#
Both tasks have Test Settings, which connects with what is in the form and says whether it worked. Then run the job once with a test queue, and look at the broker's own console for the message.
When it does not connect: the address and port; the firewall; the certificate (try once with the accept-any setting to tell a certificate problem from all others, then take it out again); the user's rights on that queue.
See JMS task and Kafka task for every field.