Preserving ActiveMQ message ordering

Solution Verified - Updated -

Environment

  • JBoss FuseMQ

Issue

User would like to consume messages from the queue in the same order the messages have been placed there by a producer.

Resolution

First of all - if only single producer writes to the given queue and only single consumer reads from that queue, then ActiveMQ will preserve the order in which the messages arrived to the broker. No additional actions or configuration changes are required in such scenario.

If you would like to preserve the message ordering with multiple consumers reading from the same queue, consider using Exclusive Consumer [1] or JMS Message Groups [2].

[1] http://activemq.apache.org/exclusive-consumer.html
[2] http://activemq.apache.org/message-groups.html

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments