camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Transaction and Multicast() or to() AND to() ?
Date Tue, 19 May 2009 08:29:31 GMT
On Tue, May 19, 2009 at 10:13 AM, Charles Moulliard
<cmoulliard@gmail.com> wrote:
> +1.
>
> Do you confirm that transacted() must only be defines in the first route
> (see my example) ?
Yes as transacted() marks the route as transacted from this point
forward. So eg it must be the first DSL in the route.
It makes no harm to mark it transacted() twice, eg in your 2nd route also.


>
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
>
>
> On Tue, May 19, 2009 at 10:03 AM, Claus Ibsen <claus.ibsen@gmail.com> 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
>> >>
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>



-- 
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