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.



--
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.

Reply via email to