2 Replies Latest reply on Oct 8, 2008 3:39 AM by alrubinger

    Multiple MDBs, multiple queues

      I have an MDB that listens to an ActiveMQ queue. It work beautifully. It registers with AMQ and onMessagae fires for each message posted to the queue. I have a business rule that forces me to process all messages in the order they were posted to the queue. To accomplish this, I have set maxMessagesPerSessions=1 and maxSessions=1.

      Now I need to expand my application with another MDB listening to a different queue, again, order is important. I have added a new MDB class with annotations that reference the new queue. When I deploy to the server, my beans both connect to their respective queues (I can see this in the AMQ log).

      However, when I post a message to either queue I get inconsistent results. Whichever queue I post to FIRST will work, and the corresponding MDB's onMessage fires. At this point, if I post a message to the other queue, the message is not delivered. The onMessage method of the other MDB is never invoked, nor are there any exceptions. The message just sits on the queue. Bouncing my server doesn't help.

      In an attempt to learn more, I took out the maxMessagesPerSessions and maxSessions annotations, and the behavior changed, but I'm not sure it is an improvement. Now, both queues seem to work properly **AFTER the first message**. I've turned on every logging option I could find, and what I see in this case is that when the first message is posted to any queue, a ServerSessionImpl is requested from the pool, but it never runs and onMessage is not invoked.

      I'm using JBoss 4.2.2 and ActiveMQ 5.1.0. I have AMQ deployed as a stand-alone service. I use annotations in leiu of XML config files, except for the ra.xml, which points to the server at tcp://localhost:61616.

      Any suggestions on how to make my MDBs get along?

      Thanks,
      - Dave