1
votes

I'm using ActiveMQ along with Mule (a kind of ESB based on Spring). We got a fast producer and a slow consumer. It's synchronous configuration with only one consumer.

Here the configuration of the consumer in spring style: http://pastebin.com/vweVd1pi

The biggest requirement is to keep the order of the messages. However, after hours of running this code, suddenly, ActiveMQ skips 200 messages, and send the next ones.The 200 messages are still there in the activeMQ, they are not lost. But our client (Mule), does have some custom code to check the order of the messages, using an unique identifier.

I had this issue already a few month ago. We change the consumer by using the parameter "jms.prefetchPolicy.queuePrefetch=1". It seemed to have worked well and to be the fix we needed unti now when the issue reappeared on another consumer.

Is it a bug, or a configuration issue ?

1
When you say the messages are skipped, and remain in ActiveMQ what does that mean? Are they in the queue(s) that you sent them to, or elsewhere?Jakub Korab

1 Answers

0
votes

I can't talk about the requirement from a Mule perspective, but there are a couple of broker features that you should take a look at. There are two ways to guarantee message ordering in ActiveMQ:

Message groups are a way of ensuring that a set of related messages will be consumed by the same consumer in the order that they are placed on a queue. To use it you need to specify a JMSXGroupID header on related messages, and assign them an incrementing JMSXGroupSeq number. If a consumer dies, remaining messages from that group will be sent to another single consumer, while still preserving order.

Total message ordering applies to all messages on a topic. It is configured on the broker on a per-destination basis and requires no particular changes to client code. It comes with a synchronisation overhead.

Both features allow you to scale out to more than one consumer.