5 Replies Latest reply on Jun 23, 2009 3:50 PM by ryanhos

    one jms-bus. multiple jms-listeners?

      If I define a jms gateway, can multiple services receive the message by referencing it in a jms-listener element?

      Or, do I have to route it from service -> service -> service?

      Thanks.

        • 1. Re: one jms-bus. multiple jms-listeners?
          tfennelly

          You can do it using a selector on the jms bus config e.g.

          <jms-bus busid="LostMessageServiceGW">
           <jms-message-filter
           dest-type="QUEUE"
           dest-name="queue/quickstart_exceptions_faults_GW"
           selector="serviceName='LostMessageService'"
           />
          </jms-bus>


          A number of the quickstarts demonstrate this.

          • 2. Re: one jms-bus. multiple jms-listeners?
            ryanhos

            This is not recommended if you are using JBoss MQ as your messaging provider.

            Ryan

            • 3. Re: one jms-bus. multiple jms-listeners?
              ryanhos

              Oops.

              It looks like tfennelly and I both misread your question.

              1.) Tom's comment describes the manner of using one queue to back several services by using a message selector. However, each message will only be processed by one service.

              2.) My comment regarding the use of message selectors with long queues in MQ is valid, but not applicable to your question.

              3.) If you want multiple services to each receive the same message, you have multiple options (in no particular order):

              3.1) Never tried it, but set up a topic, rather than a queue, and configure service listeners to subscribe to the topic. This ought to work.

              3.2) Set up one service that uses StaticRouter to multi-route to the three other services.

              3.3) Forward from service to service to service (using StaticRouter) as you already identified.

              3.4) Code up a Routing Slip Router [PoEAA] and donate it? I could sure use one. :)

              • 4. Re: one jms-bus. multiple jms-listeners?

                Thank you, ryanhos. I've set up a simple service, only responsible for routing. I'll look into a proper Routing Slip implementation.

                • 5. Re: one jms-bus. multiple jms-listeners?
                  ryanhos

                  D'oh.

                  Documentation for the Routing Slip Router is in Enterprise Integration Paterns, not Patterns of Enterprise Application Architecture....wrong big black Addison Wesley book.

                  Both are worth the read, BTW.