Friday, June 29, 2012

ActiveMQ Message Sequencing : Analysis Part I

Message Sequencing POC:
In most of the corporate production environments, messages are not sent and received from the same broker. Message might end up from multiple hops and clusters within infrastructure before it actually hits the business consumer. I did a small analysis with ActiveMQ out of the box configuration to use sequencing. Below are the results.
Test Case 1:
Messages are sent to queue / Topic and received in same broker (even from Virtual Destination queue). Single producer and exclusive consumer are used.
Result:
1.       Messages are always received in Sequence in normal running consumer
2.       Message maintains their sequence even if consumer thread restarts in between
3.       Message Priority is IGNORED and sequenced is maintained 
4.       Results matches the documentation provided here: http://activemq.apache.org/exclusive-consumer.html
Test Case 2:
Messages are going through multiple hops before get consumed from exclusive consumer.
Result:
1.       Message loses sequence
2.       Priority Set on the messages resets to default (‘4’) regardless of producing value.

Summary:
·         If producer and consumer maintained in same broker and consumers are made exclusive; message sequencing is guaranteed.
·         If message is making multiple hops before reaching to consumer, sequencing is NOT guaranteed even if Exclusive consumers are used.

 In Part II, we will use JMXGroupId concept for message sequencing and find the right results.

Tuesday, June 19, 2012

Virtual Topic SelectorAware Consumers

Making a Consumer selectorAware comes with a lackuna.
If selectorAware property is r’true’, by default, consumer queue will not pull the message from the Topic, unless there is atleast one ‘Active Consumer Application’ listening to consumer queue. Even if there is no selector defined on the consumer queue.
On the contrary, if the selectorAware is false, all the messages from the Topic will be posted to consumer queue regardless of consuming application availability.
So, its actually a design decision to use this flag wisely for proper implementation.