You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dbmeikap <db...@gmail.com> on 2011/12/27 15:18:53 UTC

Open Transaction is not working after aggregation strategy applying

In my project i am converting one message format to another. My route builder
contains following pseudo code -
from("source end point")
  .policy(PROPAGATION_REQUIRED)
  .processRef("inMessageDBWriter") //Write input message to Database
  .processRef("processor1")
  .processRef("processor2")
  .aggregate(My custom strategy) 
  .constant(true) 
  .completionSize(5) 
  .completionInterval(10000L)
  .processRef("outMessageDBWriter") //Write output message to Database
  .to("destination end point");

Currently i am facing a problem at "outMessageDBWriter" processor, saying
that Transaction is required. I have seen that after aggregation next steps
run in a different thread. So already opened Transaction is not propagate to
the new thread. 

How can i resolve this problem?

--
View this message in context: http://camel.465427.n5.nabble.com/Open-Transaction-is-not-working-after-aggregation-strategy-applying-tp5103177p5103177.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Open Transaction is not working after aggregation strategy applying

Posted by dbmeikap <db...@gmail.com>.
Hi Claus,
   Thank you for your valuable suggestion. 

I don't want to break this operation in two transactions. Since i have to
add one more intermediate end point. I don't want this, so i am change my
process sequence slightly. Now i am writing out put messages to data base
before aggregation.

--
View this message in context: http://camel.465427.n5.nabble.com/Open-Transaction-is-not-working-after-aggregation-strategy-applying-tp5103177p5107281.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Open Transaction is not working after aggregation strategy applying

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You should view this as 2 transactions. The 1st is for messages
flowing into the aggregator.
The 2nd transactions if for message flowing out of the aggregator.

The Spring TX manager does not support spanning transaction in
multiple threads. It has to be done in the same thread.

Then you can use the persistent support of the transaction to safely
store the messages.

Chapter 9 in the Camel in Action book covers transactions, and the
persistence support
of the aggregator.

You can also find details of information on the Camel web site.


On Tue, Dec 27, 2011 at 3:18 PM, dbmeikap <db...@gmail.com> wrote:
> In my project i am converting one message format to another. My route builder
> contains following pseudo code -
> from("source end point")
>  .policy(PROPAGATION_REQUIRED)
>  .processRef("inMessageDBWriter") //Write input message to Database
>  .processRef("processor1")
>  .processRef("processor2")
>  .aggregate(My custom strategy)
>  .constant(true)
>  .completionSize(5)
>  .completionInterval(10000L)
>  .processRef("outMessageDBWriter") //Write output message to Database
>  .to("destination end point");
>
> Currently i am facing a problem at "outMessageDBWriter" processor, saying
> that Transaction is required. I have seen that after aggregation next steps
> run in a different thread. So already opened Transaction is not propagate to
> the new thread.
>
> How can i resolve this problem?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Open-Transaction-is-not-working-after-aggregation-strategy-applying-tp5103177p5103177.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/