1 Reply Latest reply on Jun 13, 2006 9:46 AM by Oleg Zhurakousky

    Duplicate MDB processing of messages sent to a Topic

    Oleg Zhurakousky Newbie

      JBoss 4.0.4, JDK 1.5
      MDB subscribing to a Topic, Load Balancing (ReceiverImpl) is changed to RoundRobin.

      I was under impression that clustered MDB would represent a single image of an MDB in the clustered environment. For example: If I have an MDB subscribing to a Topic and this MDB is the only subscriber in the system, then the message would only be retrieved once (and it works fine in the single node environment). However, I would expect the same behavior in multiple node cluster, since in my view the clustered MDB represents a single image of the component /listener(not multiple listeners). Yet, in the two node cluster, both MDBs are retrieving the same message and I would assume if I add more nodes to my cluster, then . . . you got the point. In other words the 'clustered" MDB that is deployed on two nodes does not represent a single image of the component, instead it is acting as a second subscriber.

      As far as Queue. . . Due to the nature of the queues this problem doesn't exist, since once the message is been received it is removed from the queue and with MDB Load Balancing configured to do Roundrobin it is very interesting to observe how messages are processed by either MDBs

      Am i missing some configuration or my assumptions about clustered MDBs subscribing to a Topic (not a Queue) are wrong?

      I found some discussins on the simmilar topic but couldn't get a clear answer, so hoping one of you will clarify.


        • 1. Re: Duplicate MDB processing of messages sent to a Topic
          Oleg Zhurakousky Newbie

          Just to clarify some of the assumptions and also I think I am starting to understand the issue a little deeper, so in a way I am attempting to answer my own question.

          In JBoss MDBs are not clustered. They are just message listeners. We can configure various load balancing policies on Queues and Topics, but we don'r have something like true in jboss.xml as we do for EJBs (other then MDB)

          So I guess in the way it answers the question. However, it doesn't solve the problem unless:

          1. You change your implementation from Topic to Queue. This way due to the nature of the queue your message will not be retrieved more then once. And with configuring load balancing to do RoundRobin, it is interesting to observer how each server in the cluster is participating in the process.
          2. If (due to your application requirements) you still have to choose Topic over Queue, then deploying MDB as singleton, solves the issue as well. This way it failsover with HA-JMS

          Which one is better, I believe it would depend on the requirement of your application.