0
votes

We have an Application MQ Queue marked as triggered and a MQTT_FIRST set on it.

When a message arrives into that queue for the first time the Queue Manager creates a trigger message and writes it into an initiation queue we defined for that purpose. The trigger message fires up the execution of a monitoring process that will start a trigger-monitor application which will go and read messages from the application queue one by one.

We use Spring JmsTemplate to read messages one by one from the application queue. That jmsTemplate instance opens a connection to the application queue, reads a message from there and then closes the connection.

The problem we have is that when the connection is closed if there are multiple messages in the Application queue a new trigger message will be sent to the initiation queue which will cause another trigger-monitor application (running on a different host) to pop up. This is not what we want as for us it is essential to have only one message consumer active at the same time as message sequence is very important.

The reason we have multiple trigger-monitor applications (or consumers) is for a HA reason.

So my question is: Is there a way to prevent MQ manager to send multiple MQTT_FIRST trigger messages to the initiation queue and make it only send it once when a message arrives in an empty queue and that is it. If we really wanted a message trigger being sent again we can use the Trigger Interval for this but for what we are trying to achieve there should be no more than one trigger message in the initiation queue no matter what.

Thank in advance Julian

1

1 Answers

0
votes

The problem we have is that when the connection is closed if there are multiple messages in the Application queue a new trigger message will be sent to the initiation queue which will cause another trigger-monitor application (running on a different host) to pop up.

.

Is there a way to prevent MQ manager to send multiple MQTT_FIRST trigger messages to the initiation queue and make it only send it once when a message arrives in an empty queue and that is it.

Yes, don't close the connection. You need to read the rules when using Trigger First. One of the rules is to consume ALL of the messages before closing the connection. If you don't follow the rules then you can't complain.