On Wed, Mar 20, 2013 at 8:20 PM, moxximus <[email protected]> wrote: > I've ran into a bit of odd behavior from the JPA component. I've configured a > JPA consumption route as follows: > > from("jpa:com.models.MyRecord?consumeDelete=false&consumer.query=select r > from com.models.MyRecord r where r.batchID = NULL").to("direct:jpaOut"); > > The model contains the following update function: > > @Consumed > public void consume() { > batchID = "MyNewBatch"; > } > > This updates the database perfectly fine, as expected. My issue comes in > when attempting to use the batchID further down the route. I thought that > the @Consumed function would be executed before the message is passed out of > the JPA component. I've tried synchronizing all functions that interact with > the batchID field but this doesn't resolve the issue. This leads me to > believe that the @Consumed function isn't guaranteed to be executed before > the message is passed out of the JPA component. > > Can any confirm or deny this? I can put together a unit test from my code if > someone can confirm this is unexpected behavior. >
Its run AFTER the exchange is done being routed (eg at the end). The docs on the web-site could be a bit more clear yeah. > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/When-are-Consumed-methods-called-by-the-JPA-component-tp5729562.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. FuseSource is now part of Red Hat Email: [email protected] Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
