4 Replies Latest reply on Jan 4, 2008 12:19 PM by Jonathan Duty

    MDB and clustered Topics

    Jonathan Duty Newbie

      I've tried to answer this question myself through forms and the documentation but I've been unable (probably due to my own misunderstanding).

      Env:

      JBoss 4.2.2
      JBoss Messaging 1.4.0.SP1


      I have a node of 3 servers, and I'm deploying the same ear to all 3. In that ear I have a MDB that consumes from a topic using a durable subscription where I specify the sub name and client id.

      So what this means is that each server has an instance of the MDB that consumers from a topic using the same sub name and client id. My question is should this topic be clustered? When a message is posted to the topic I only want 1 of the mdb instances in the cluster to get a copy, not one on all 3 machines?

      Thanks in advance.
      ~Jonathan

        • 1. Re: MDB and clustered Topics
          Tim Fox Master

          A Topic is JMS mechanism for publish-subscribe messaging.

          This basically means that multiple subscribers can subscribe to a particular topic (e,g, a news feed), and _all_ the subscribers will receive messages posted to that topic.

          JMS also supports what is known as point to point messaging using Queues. In this mode, a message is posted to a queue, and is only consumed by a single consumer.

          An example of this would be an order processing queue, where you only want each order to be processed by one order processor.

          Since you only want your message processed by one consumer, sounds like you want to use a queue rather than a topic.

          If you use a non clustered topic, then all consumers on *that node* will receive all messages published to the topic.

          If you use a clustered topic, then all consumers on *all nodes* will receive all messages published to the topic.

          • 2. Re: MDB and clustered Topics
            Jonathan Duty Newbie

            THanks for the quick reply Tim.

            I guess a better description of what I'm using is a clustered durable subscription. In that case, would only one receive the message?

            On another note I do need a topic because on each node I have multiple MDBs, all subscribing to different clustered durable subscriptions.

            • 3. Re: MDB and clustered Topics
              Tim Fox Master

              Ok I think I understand what you are doing now :)

              JBM does support clustered durable subscriptions.

              If you had multiple MDBs on different nodes of the cluster with the same client id and durable subscription name, then JBM will ensure that only one of them will get the message.

              This allows you to spread processing of messages from a particular durable subscription across the cluster.

              This is a nice feature of JBM you won't find in many other JMS providers.

              • 4. Re: MDB and clustered Topics
                Jonathan Duty Newbie

                Fantastic! Thank you Tim.

                The great responses to posts is also something you won't find with other JMS providers ;) Thanks to the messaging team for great all around service!

                +1 beer to all of you.

                ~Jonathan