5 Replies Latest reply on Apr 18, 2011 3:14 AM by Ben Clark

    Camel routing problem

    Ben Clark Newbie

      Hi guys!

       

      I have a routing problem with camel, I'll try to explain it:

       

      I have 3 components:

      - a JMS queue

      - two bean components with a In-Out MEP

       

      My workflow is quite simple :

       

      File polling -> JMS queue -> Bean A -> Bean B -> File sender (moving a file)

       

      I used Camel to make the routing between the components:

       

      from("file:///c:/tmp/poller").to("activemq:queue/myqueue").pipeline("jbi:endpoint:urn:xx:activities:bean-a:endpoint", "jbi:endpoint:urn:xx:activities:bean-b:endpoint", "file:///c:/tmp/sender");

       

      But on the runtime I have the following exception: "Out message not supported"

      I suppose it's because of my bean.. but with this pipeline I thought that the bean's message were routed to next component.. as I shown on my workflow. :s

       

      What may I do to complete this workflow ?

        • 1. Re: Camel routing problem
          Claus Ibsen Master

          When you send the message to the JMS queue you have to consider what thats should be

          - inOnly (aka fire and forget)

          - inOut (aka request-reply)

           

          What happens now is the file polling will be in inOnly mode, which means the messages is send as fire and forget to the message queue. And then right thereafter processed in that pipeline.

           

          It seems JBI is less forgiving about if the exchange pattern isn't configured as it expects. So you may want to change the exchange pattern to InOut.

           

          There is a .setExchangePattern(ExchangePattern.InOut) you can use.

          • 2. Re: Camel routing problem
            Ben Clark Newbie

            First, thanks for you reply.

             

            Then, I have to change the MEP of the polling or of the JMS Queue ?

             

            But even if I change these MEPs, it didn't resolve my problem I think..

            Indeed, I'm trying to use the pipeline EIP to redirect the output of my A bean to the input of my B bean.. but it don't work as I said

            • 3. Re: Camel routing problem
              Ben Clark Newbie

              To resume my problem I just want that when there is a new message into my JMS queue, I call a Bean component (with an In-Out MEP) and camel redirect this call to a In-Only MEP (like a file sender component)

              • 4. Re: Camel routing problem
                Claus Ibsen Master

                You change the MEP where you need it changed.

                 

                If you do it after the JMS queue, then you do a fire and forget send message to the JMS queue, as it was InOnly.

                • 5. Re: Camel routing problem
                  Ben Clark Newbie

                  Yes, it was the correct solution.

                  For the next who will have this error, you have to add:

                   

                  to(ExchangePattern.InOut, "jbi:endpoint:xxx:service:endpoint")

                   

                  Thanks for your help!