5 Replies Latest reply on Apr 17, 2013 11:01 AM by dward

    How do I configure multiple projects (services) to listen to the same queue?

    puttime

      My situation is like this:

       

      1. I have two projects (services) S1 and S2 which need to listen to the same queue.
      2. When a message, like  

      <?xml version="1.0" encoding="UTF-8"?>

      <send>

          <name>dippy</name>

      </send>

                the above comes along, it should be sent to both S1 and S2.

       

      3. When a message like,   

      <?xml version="1.0" encoding="UTF-8"?>

      <send1>

          <name>dippy</name>

      </send1>

           comes along, it should be sent to only S1.

       

      4. When a message like,   

      <?xml version="1.0" encoding="UTF-8"?>

      <send2>

          <name>dippy</name>

      </send2>

           comes along, it should be sent to only S2.

       

       

      Is this possible and how?

        • 1. Re: How do I configure multiple projects (services) to listen to the same queue?
          kcbabo

          You could receive all of those messages into a routing service S3 and then use CBR within the route to dispatch to S1, S2, or S1 and S2 based on the message content.  There's nothing in the binding logic that would allow you to selectively received based on the message content.  You could introduce a JMS message selector, but that filters based on message properties and not the content.

          1 of 1 people found this helpful
          • 2. Re: How do I configure multiple projects (services) to listen to the same queue?
            puttime

            Which is the quickstart example I can look at to do a CBR (Content based routing)?

            • 4. Re: How do I configure multiple projects (services) to listen to the same queue?
              puttime

              [Please correct me if I'm wrong.]

              I had a look at rules-camel-cbr, but it seems it may not fit my solution, because it doesnn't have an exposed end point.

               

              The situation is this:

               

              1. I need to expose a JMS end point, so that clients can send messages over the queue.
              2. The message received on the queue should get forwarded to the service (Camel or Bean I'm not sure) , because I had promoted the service.
              3. In that service, I examine the XML content, and I should be able to route the messages to the right destination (another service).

               

               

              Which 'quickstart' example would be a good starting point for this?

              • 5. Re: How do I configure multiple projects (services) to listen to the same queue?
                dward

                There is no quickstart example that does exactly what you are looking for, from end-to-end.  Realisticaly, it would be impossible for us to have a separate quickstart for every possible real-world scenario out there.  You can't expect that.  But what you can do is go through the quickstarts yourself, read their Readme files, look at their switchyard.xml files, and pick-and-choose from them the pieces that you need.  Exposing a JMS endpoint? There's examples of that.  Invoking service references whose implementations are camel or bean?  There's examples of that.  Examining XML content? There's examples of that.  Routing messages to specific destinations? There's examples of that.

                 

                My best advice to you is to take a step back and look at your application from an architectural or functional perspective.  What are the big moving parts?  Look for the separation of concerns, and model the application after them.  Then, each smaller piece becomes a simpler problem to solve ("divide and conquer").  My bet is that there are quickstart examples for each of those smaller pieces.  But then, it is up to you to put them together; the end result being your application.  We can't do that for everyone out there.