Pheonix
Pheonix

Reputation: 21

How consume messages in specific sequence in ActiveMQ?

I have a requirement to maintain a specific sequence/order of messages that i am sending in ActiveMQ Queue and those should be consumed in that order only.

For example : I have 10 messages and i would want them to be sent in a specific sequence such as - 4,2,1,5,3,6,8,7,9,10.

I am aware about the message priority but that will not solve my problem in case i have more than 10 messages as we can have priorities only from 0 to 9, so this is not really about the message priority but the maintaining a specific sequence/order among the messages.

I would appreciate any pointers on this.

Thanks

Upvotes: 0

Views: 542

Answers (1)

Tim Bish
Tim Bish

Reputation: 18356

Messages are dispatched from a Queue in the order they arrived unless you use selectors or priority to get around that. If the messages need to be consumed in an order other than the one they are sent in then you may need to consider some external solution such as a Camel Resequence type EIP based solution. Always remember that a broker is not a database and treating it as such is doomed to failure.

Upvotes: 1

Related Questions