samedi 11 avril 2015

Camel routes and transactions

My program has a CXF camel route, and it receives a soap message, starts a JPA route, and returns OK.


The JPA route writes to the database so I need it to be in a transaction, but the web service returns before the new JPA route finishes, so I think that's why my attempts to use CMT or JTA is failing: (the web service transaction ends before the created JPA camel route manages to commit)


So let's say I switch to RESOURCE_LOCAL and don't use JTA, and go completely app-managed.


Can I still use LocalContainerEntityManagerBeanFactory?


Probably not... it has the word 'Container' in it. But the only reason I swapped to LocalContainerEntityManagerBeanFactory is because it lets me set the persistence.xml location (which I can change with properties file). I need to be able to change the data source without recompiling.


So, there's that, and then, how do I tell the RouteBuilder to use it's own transaction, that won't die when the web service call returns?


Aucun commentaire:

Enregistrer un commentaire