camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: Transaction and Multicast() or to() AND to() ?
Date Tue, 19 May 2009 09:41:32 GMT
Hi Charles,

camel-jms doesn't support to handle the InOut Message in a single
transaction. You can find more information in the JMS wiki page[1]

Here is the section that you may interesting.

Note that when using Request Reply over JMS you cannot use a single
transaction; as JMS will not send any messages until a commit is
performed so the server side won't receive anything at all until the
transaction commits. So with request/response you must commit a
transaction after sending the first request and then use a separate
transaction for receiving the response.

Its for this reason that the transacted property only applies to InOnly
message Exchange Pattern. If you still want to use transacted for InOut
then you must use transactedInOut=true.

[1] http://camel.apache.org/jms.html

Willem



Charles Moulliard wrote:
> Hi Willem,
> 
> What do you mean here : "Current the JMS component doesn't provide the
> transaction support the
> InOut Message..." ? This text is not clear
> 
> Regards,
> 
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
> 
> *****************************
> blog : http://cmoulliard.blogspot.com
> 
> 
> On Tue, May 19, 2009 at 10:40 AM, Willem Jiang <willem.jiang@gmail.com>wrote:
> 
>> Just some notes:
>> Current the JMS component doesn't provide the transaction support the
>> InOut Message. Since if we don't commit the IN message , this message
>> will not be consumed by its consumer, and it is impossible to get the
>> response message back.
>>
>> Multicast supports to process the message parallelly. If enable this
>> feature, Camel will use the thread pool to do the message processing
>> work, and it can't be transactional.
>>
>> Willem
>>
>> Claus Ibsen wrote:
>>> On Tue, May 19, 2009 at 9:58 AM, Charles Moulliard <cmoulliard@gmail.com>
>> wrote:
>>>> Thanks Claus.
>>>>
>>>> Additional question :
>>>>
>>>> Can  two routes be part of the same transaction ?
>>> Yes as long as they run in the same thread, eg as you do link them with
>> direct.
>>> Do not use seda as it will break it into 2 threads.
>>>
>>> Spring TX manager uses the same thread for its TX management.
>>>
>>>
>>>> ex :
>>>>
>>>> <route>
>>>>     <from uri="activemq:queue:order.in"/>
>>>>     <transacted/>
>>>>     <to uri="bean:orderService?method=validate"/>
>>>>     <to uri="direct:processOrder"/>
>>>>  </route>
>>>>
>>>>  <route>
>>>>     <from uri="direct:processOrder"/>
>>>>     <to uri="bean:orderService?method=process"/>
>>>>     <to uri="activemq:queue:order.out"/>
>>>>  </route>
>>>>
>>>> Regards,
>>>>
>>>>
>>>> Charles Moulliard
>>>> Senior Enterprise Architect
>>>> Apache Camel Committer
>>>>
>>>> *****************************
>>>> blog : http://cmoulliard.blogspot.com
>>>>
>>>>
>>>> On Tue, May 19, 2009 at 9:43 AM, Claus Ibsen <claus.ibsen@gmail.com>
>> wrote:
>>>>> On Tue, May 19, 2009 at 9:11 AM, Charles Moulliard <
>> cmoulliard@gmail.com>
>>>>> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I would like to know if the transactional behavior of camel/spring
>> will
>>>>> be
>>>>>> the same comparing the two next routes :
>>>>>>
>>>>>> 1) Multicast
>>>>>>
>>>>>> from()
>>>>>> transacted()
>>>>>> multicast(
>>>>>> to(bean:update DB)
>>>>>> to(queue:IN)
>>>>>> )
>>>>>>
>>>>>> 2) To() and to()
>>>>>>
>>>>>> from()
>>>>>> transacted()
>>>>>> to(bean:update DB)
>>>>>> to(queue:IN)
>>>>>>
>>>>> Yes the TX is the same.
>>>>>
>>>>>
>>>>>> Does it make sense to multicast messages when we want that data
>>>>>> updated/inserted DB are rollbacked if an error occurs during creation
>> of
>>>>> the
>>>>>> message on the queue OR messages removed from the queue if an errors
>>>>> occurs
>>>>>> during DB update ?
>>>>> Spring TX manager will rollback the TX if it was marked for rollback
>>>>> or it caughts a runtime exception.
>>>>> So whatever you from the transacted() onwards will occur in the same
>> TX.
>>>>> Using either .to or .multicast has really nothing to do with TX.
>>>>>
>>>>> The former is the Pipes And Filters EIP where output from the previous
>>>>> is input to the next and so forth.
>>>>> The latter is the Recipient List EIP where you send the *same* message
>>>>> to multiple recipients.
>>>>>
>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Charles Moulliard
>>>>>> Senior Enterprise Architect
>>>>>> Apache Camel Committer
>>>>>>
>>>>>> *****************************
>>>>>> blog : http://cmoulliard.blogspot.com
>>>>>>
>>>>>
>>>>> --
>>>>> Claus Ibsen
>>>>> Apache Camel Committer
>>>>>
>>>>> Open Source Integration: http://fusesource.com
>>>>> Blog: http://davsclaus.blogspot.com/
>>>>> Twitter: http://twitter.com/davsclaus
>>>>>
>>>
>>>
>>
> 


Mime
View raw message