camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanson2010 <hanson2...@gmail.com>
Subject Transaction configuration in Java DSL
Date Thu, 18 Nov 2010 10:07:30 GMT

What I'm trying to do is moving data from IBM MQ to ActiveMQ, and ensuring no
data lost during network failure or something like that. So TRANSACTION
comes into my mind. But I can't get it run in Java DSL. (Spring DSL will be
okay strangely.)

Camel 2.5.0
IBM MQ 7.0.1
ActiveMQ 5.4.1

CamelContext camel = new DefaultCamelContext();
...
JmsComponent wmq = JmsComponent.jmsComponentTransacted(mqConnectionFactory);
wmq.setTransactionManager(transactionManager);
camel.addComponent("wmq", wmq);
...
try {
	camel.addRoutes( new RouteBuilder() { 
		public void configure() { 
			errorHandler(new
TransactionErrorHandlerBuilder().maximumRedeliveries(-1));
			from("wmq:QL_TEST1")
			.transacted()
			.to("amq:TEST1");
			from("amq:TEST1").process(new Processor() {
				public void process(Exchange e) {
				System.out.println("Received exchange: " + e.getIn().getBody());
				}
			});
		} 
	}); 
	camel.start();
} catch (Exception e) {
	logger.error("Exception in camel: " + e.getMessage());
	return;
}

Error is like this:
[main] ERROR: Exception in camel: Failed to create route route1 at: >>>
Policy[ref:null] <<< in route: Route[[From[wmq:QL_TEST1]] ->
[Policy[ref:null]]] because of policy must be specified on: Policy[ref:null]

If I remove the .transacted() line, everything will be okay.

BTW, how can I configure the retry interval? During "network failure", the
error log file size surges really fast!

Thanks in ad!
-- 
View this message in context: http://camel.465427.n5.nabble.com/Transaction-configuration-in-Java-DSL-tp3270508p3270508.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message