2 Replies Latest reply on Apr 25, 2010 11:05 PM by gnanda1

    Transactional Scope Question

    gmotts_gary.motts

      I need to understand a bit more about the transactional scope, more specifically where does it end and where is the jta commit() is performed?

       

      If I've defined an activemq queue that is consumed by a transactional receiver <jms:consumer service> (servicemix component) and sent to a camel route which ultimately writes the message back into an activemq provider using the camel notation .to("activemq:queue:foo"), where does the scope of the transactional commit end?  Is it when the message exchange is written back into the provider queue (this is my goal) or is it when the message is consumed and sent to the camel route?

       

      Any help in understanding transactional scope is appreciated.

       

      Thanks!

      -Gary

        • 1. Re: Transactional Scope Question
          joe.luo

          Firstly, if you are planing to use Camel route to consume the message from a queue and send it to another queue, then you do not need to configure <jms:consumer> endpoint of servicemix-jms component. You just need to use Camel jms endpoint in your route like:

           

          from("activemq:queue:inputQueue").to(...).to("activemq:queue:outputQueue")

           

          The transaction will start from camel jms consumer endpoint and end with the whole route. So any exception thrown from the route will cause the message to be rolled back, hence not dequeued.

          • 2. Re: Transactional Scope Question
            gnanda1

            Hi joeluo,

              I read about your note below regarding using queue directly intsead of creating smx4 jms consumer to route  message from the queue.

            I have a scenario where I read messages from a queue then  using camel recipient list pattern I dynamically route to an external webeservice  based on the url embedded inside the message.

             

            I am still not sure in which scenarios we should go for creating smx jms consumer as an endpoint instead of using queue as an endpoint for the camel router.

            I am trying to understand pros and cons of using smx jms consumer. And if  I use it as my endpoint then how would go with transaction. Shuld I start atransaction from jms consumer as XA which will pass alng to the camel router?

            Please suggest