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: When are @Consumed methods called by the JPA component?
Date Thu, 21 Mar 2013 07:15:59 GMT
On Wed, Mar 20, 2013 at 8:20 PM, moxximus <mccann.matt@gmail.com> 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: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message