3 Replies Latest reply on Jun 20, 2008 6:47 AM by ataylor

    Again Message Order and MDB

    mclu

      Hi!

      Its mee again.
      I spend arround 5 hours now digging in JBM code to find out why my system behaves as it does.

      Testenvironment:
      - One local persistent Queue with a lot of messages in.
      - An EJB3 MDB attached to the Queue using maxSession and maxMessages set to 1
      - redelivery is set to MDBs default (5 think)
      - JBM 1.4.0 SP3 on 4.2.1 GA

      To test Logic errors and the ways JBM handles exceptions I set context.setRollbackOnly() while handling the messages in my MDB onMessage() method.


      What I thought is this behaviour of Message A B C....:
      A -> fail
      A -> fail
      A -> fail
      A -> fail
      A -> fail -> DLQ
      B -> fail
      B -> fail
      B -> fail
      B -> fail
      B -> fail -> DLQ
      and so on

      But what happens is always a handling of 2 messages:
      A -> fail
      B -> fail
      A -> fail
      B -> fail
      A -> fail
      B -> fail
      A -> fail
      B -> fail
      A -> fail -> DLQ
      B -> fail -> DLQ
      C -> fail
      D -> fail
      C -> fail
      D -> fail
      and so on...

      While debugging and tracing I see that the ClientConsumer
      calls removeFirst() on the BasicPriorityLinkedList from 2 Threads and in twisting manner the addFirst() and removeFirst() which lead in this A,B,A,B order.

      What can I do to have this AAAABBBB handling?

        • 1. Re: Again Message Order and MDB
          ataylor

          This is an MDB container question, probably to do with pool size etc. refer to http://wiki.jboss.org/wiki/ConfigJBossMDB on how to configure MDB's.

          FYI The JMS spec doesn't require message order to be preserved after rollback.

          • 2. Re: Again Message Order and MDB
            mclu

            Hi again...

            Yes I know that the spec says nothing about order.

            But still this behavior is strange. The pool size is set via annotations:

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


            I just wonder why its always twisting with 2 messages instead of 3 or 5 or any higher number.
            If I can force this to 1 consumer its exacly what my customer need. :-)

            Greets

            • 3. Re: Again Message Order and MDB
              ataylor

              Like I say, this is an MDB question, if you post on the appropriate forum they will be able to help you. Remember MDB's are JMS Provider agnostic.