camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <cmoulli...@gmail.com>
Subject Re: Transaction propagation between endpoints
Date Fri, 03 Jul 2009 11:41:31 GMT
Where starts the transaction in a camel route or more precisely the
begin/commit ?

from(queueA)
.transacted()

// Transaction starts

.to(bean:saveRequest)

// Transaction propagated

.to(bean:saveRequestMessage)

// commit done
.to(queueB)

OR

from(queueA)
.transacted()

// Transaction starts
.to(bean:saveRequest)
// commit done (if no error occurs during saveRequest)

// Transaction starts
.to(bean:saveRequestMessage)
// commit done

.to(queueB)

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com


On Fri, Jul 3, 2009 at 12:36 PM, Claus Ibsen <claus.ibsen@gmail.com> wrote:

> On Fri, Jul 3, 2009 at 12:17 PM, Charles Moulliard<cmoulliard@gmail.com>
> wrote:
> > Hi,
> >
> > In Spring, it is possible to have one single transaction used between
> > several services calls (where Hibernate DAO are used by example). Here is
> a
> > small example and discussion about this subject on the web (
> > http://forum.springsource.org/showthread.php?t=73544)
> >
> > Is it possible in camel route that one single transaction encompass
> several
> > endpoints and not only one ?
> >
> > from(queueA)
> > .transacted
> > // Here is when the transaction start
> > .to(bean:saveRequest) --> save data in DB : table Request
> > // transaction propagated
> > .to(bean:saveRequestMessage) --> save data in DB : table RequestMessage
> > // transaction ended
>
> You insert a <transacted ref="NOT_SUPPORTED"/> here to switch
> transaction policy.
> Spring have X constants for REQUIRED, REQUIRES_NEW and the likes.
> There should be one for no TX please as well.
>
> http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/transaction/annotation/Propagation.html#NOT_SUPPORTED
>
>
> > .to(bean:TransformRequest)
> > .to(QueueB)
> >
> > It should be interesting to define when the transaction finished.
> >
> > Moreover, it should be able by example to test in my example if errors
> occur
> > during the call to(bean:TransformRequest), if this the case, global
> rollback
> > can be done on the two services called
> >
> > 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message