4 Replies Latest reply on Jun 13, 2011 10:23 AM by Richard Kennard

    HornetQ Stuck Scenario: Batches of messages with different JMS priorities

    Richard Kennard Novice

      Hi guys,


      I am trying to upgrade our JBoss Messaging application to use HornetQ. I am experiencing my MDBs getting 'stuck' and I have managed to untangle a few different scenarios that cause this. I will try and put together test cases, but I would appreciate your help as to where to look.


      My app needs to process batches of messages. Each batch is, say, 100 messages. The processing involves 3-4 stages. Each stage works by resending messages to the back of the queue, ready for processing by the next stage. So that these stages process in some kind of reasonable sequence compared to other batches that may be arriving on the queue, we assign different batches different JMS priorities (decided at random). So the first batch of 100 may get priority #5 (for all messages and all stages), the second batch priority #8, the third priority #1 etc.


      What seems to be happening is that, after a while, HornetQ stops processing one of the batches. This is always at the *start* of a new batch, and seems to often be with JMS priority #6.


      Is there any logic to this? Is there some kind of 'message priority balancing' algorithm inside HornetQ that could potentially get confused and decide a certain priority message is never routed to any MDB? Once we have gotten stuck like this, no more messages (even higher priority messages) are ever delivered to the MDB.


      If we remove the 'assign random priority to each batch' line in our code, everything works fine.