Out of order messages in Jboss

334 views Asked by At

We faced an issue in the message driven bean (MDB). When multiple messages are received at the MDB at a same time, starting to process messages out of order. (execution sequence is not same as the receiving sequence)

eg:

Original order of the messages : Message 1, Message 2, Message 3

But in the application level onMessage() invoked in incorrect order.

eg: Message 2, Message 1, Message 3

We are using the EJB3 message driven annotations in our MDB while Jboss version is Jboss EAP 6.4 and implementation is HornetQ

  @MessageDriven(activationConfig = { 
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
 
        @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/Queue1"),
 
        @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),
 
        @ActivationConfigProperty(propertyName = "reconnectAttempts", propertyValue = "-1"),
 
        @ActivationConfigProperty(propertyName = "minSessions", propertyValue = "1"),
 
        @ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "1"),
 
        @ActivationConfigProperty(propertyName = "maxMessagesPerSessions", propertyValue = "1"),
 
        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")}, name = "MessageDrivenBeanEJB")

How can we make sure message consumption order is same as the receiving order?

1

There are 1 answers

2
Steve C On

You have incorrect config property names for HornetQ. Try

@ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1"),

You should find out which of the others that you have specified are correct for HornetQ because these look like parameters from an earlier JBoss Messaging incarnation.