Hi
On Wed, Jun 4, 2014 at 12:10 PM, andersbohn <[email protected]> wrote: > [[Sry about the badly formatted post - hope this is better]] > > Ok, I've fiddled and got something running - not fully tested yet :) > > Any comments are appreciated. If it's sound, could this be added to > camel-cdi ? Or at least documented og added as an example ? > We love contributions, so people is welcome to improve the docs / build an example etc. http://camel.apache.org/contributing.html We also got a cookbook sections where smaller code snippets and how-to's can be added http://camel.apache.org/cookbook.html > > @Named("transactionManager") > public class CdiJtaTransactionManager extends JtaTransactionManager { > > @Resource(lookup = "java:jboss/TransactionManager") > private TransactionManager transactionManager; > > @Resource > private UserTransaction userTransaction; > > > public CdiJtaTransactionManager() { > super(); > } > > @PostConstruct > public void setManager() { > setTransactionManager(transactionManager); > setUserTransaction(userTransaction); > } > > } > > @Named("PROPAGATION_REQUIRED") > public class CdiRequiredPolicy extends SpringTransactionPolicy { > > @Inject > public CdiRequiredPolicy(CdiJtaTransactionManager > cdiJtaTransactionManager) { > super(new TransactionTemplate(cdiJtaTransactionManager, new > DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRED))); > } > > } > > > @Singleton > @Startup > public class CamelBootstrap { > > @Inject > private CdiCamelContext camelCtx; > > @Resource(mappedName = "java:/JmsXA") > private ConnectionFactory connectionFactory; > > camelCtx.addComponent("jms", > JmsComponent.jmsComponentTransacted(connectionFactory)); > > Now I can configure a JMS-route starting like this: > > from("jms:queue:Nemhandel_Leverandoer_Inbound") > .transacted("PROPAGATION_REQUIRED") > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Transacted-Apache-Camel-Route-with-CDI-in-AS7-tp5751824p5751873.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
