camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ext2" <>
Subject How implement customed transaction section in camel?
Date Wed, 21 Apr 2010 14:41:00 GMT

	Camel 's transaction-policy is applied for all processors in the
route;  but how to use this features to implement a customized transaction
section in camel? Etc: if I could assign a transaction-policy to a single
pipe-line processor(not the whole route), I could define custom transaction
section easily;

To illustrate this usage I give a sample , and I want to know is there
a-better solution to  use camel;

For example: A application which read message from jms and, save the message
to 2 different database table(A, B). This application asks for this
transaction features: 

Two  database table must keep in a same transaction: one failed another

Jms  must take part in seperate transaction, that's to say if both database
success, the jms will commit; if one database failed, I will log the jms
message in a storage, and jms will commit;  But if logging failed, the jms
will rollback;
And how to full-fill this transaction features using camel? 
Must I separate the complete route into different route piece just for
transaction support? 
Could camel support the define a transaction range (but not a

Even I separate the complete route into different route just for transaction
support, it still has a difficult: how to declared a new transaction for a
processing route( in this sample , I need to declare a new transaction for
table-A and table-B processors);   if I declared a required-new-transaction
policy, all the processor in route act in a separate transaction; and it
cannot full-fill such demand: table A and table B act in a transaction;
To resolve this problem , I must introduce another route just act as a
bridge for the new-tx-range);following is a solution use camel's current
transaction policy to  this example, but it's hard to understand:

routeA: (jms)

routeB:(this is the hardest part for usage)
(from direct:new-tx-op)-->new-tx -policy-->(to direct:db-op)

Route C:
(from direct:db-op)-->(required-tx-policy)-->(table A save)-->(table B save)

So does camel support a feature to define transaction range? So the route
will looks like

(from jms)-->pipeline(required-tx) -->[dotry-->pipeline(new-tx)-->[(table
A)-->(table B)]-->docatch-->log];

If camel could assign a transaction-policy to single pipe-line process ,
this feature could be achieved easily;

View raw message