Details
-
Bug
-
Resolution: Done
-
Major
-
2.8.0-fuse-01-11
-
None
-
None
Description
Consider the following route:
@Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from("activemq:queue:start") .enrich("direct:enrich", new AggregationStrategy() { public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { System.out.println("#################" + oldExchange); System.out.println("#################" + newExchange); oldExchange.getIn().setBody(newExchange.getIn().getBody()); return oldExchange; } }) .to("mock:result"); from("direct:enrich") .loadBalance().failover(1, false, false, IOException.class) .inOut("seda:failover1", "seda:failover2") .end(); from("seda:failover1") .to("mock:failover1") .process(new Processor() { // mimick the CXF behavior public void process(Exchange exchange) throws Exception { exchange.getOut().setFault(true); exchange.setException(new IOException("forced exception for test")); } }); from("seda:failover2") .to("mock:failover2") .setBody(constant("Camel")); } };
Failover1 should force an exception and then failover2 should kick in and work. The latest version at Apache, 2.9.1, behaves correctly:
2012-03-13 12:03:08,212 [Consumer[start]] DEBUG FailOverLoadBalancer - Processing failover at attempt 1 for Exchange[JmsMessage: null]
2012-03-13 12:03:08,215 [Consumer[start]] DEBUG SendProcessor - >>>> Endpoint[seda://failover2] Exchange[JmsMessage: null]
2012-03-13 12:03:08,216 [eda://failover2] DEBUG SendProcessor - >>>> Endpoint[mock://failover2] Exchange[JmsMessage: null]
2012-03-13 12:03:08,216 [eda://failover2] DEBUG MockEndpoint - mock://failover2 >>>> 0 : Exchange[JmsMessage: null] with body: Hello and headers:Unknown macro: {breadcrumbId=ID-Susan-Javureks-MacBook-Pro-3-local-55301-1331654585635-0-1, JMSDeliveryMode=2, JMSRedelivered=false, JMSType=null, JMSReplyTo=null, JMSMessageID=ID}2012-03-13 12:03:08,216 [main ] DEBUG MockEndpoint - Took 10 millis to complete latch2012-03-13 12:03:08,217 [main ] INFO MockEndpoint - Asserting: Endpoint[mock://result] is satisfied2012-03-13 12:03:08,217 [main ] DEBUG MockEndpoint - Waiting on the latch for: 5000 millis2012-03-13 12:03:08,217 [Consumer[start]] DEBUG FailOverLoadBalancer - Failover complete for exchangeId: ID:Susan-Javureks-MacBook-Pro-3.local-55306-1331654586944-2:2:1:1:1 >>> Exchange[JmsMessage: Camel]
#################Exchange[JmsMessage: ActiveMQTextMessage {commandId = 5, responseRequired = true, messageId = ID:Susan-Javureks-MacBook-Pro-3.local-55306-1331654586944-2:2:1:1:1, originalDestination = null, or
iginalTransactionId = null, producerId = ID:Susan-Javureks-MacBook-Pro-3.local-55306-1331654586944-2:2:1:1, destination = queue://start, transactionId = null, expiration = 0, timestamp = 1331654587258, arrival = 0, brokerInTime = 1331654587258, brokerOutTime = 1331654587267, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@38650646, marshalledProperties = org.apache.activemq.util.ByteSequence@707efa96, dataStructure = null, redeliveryCounter = 0, size = 1034, properties =Unknown macro: {breadcrumbId=ID-Susan-Javureks-MacBook-Pro-3-local-55301-1331654585635-0-1}, readOnlyProperties = true, readOnlyBody = true, droppable = false, text = Hello}]#################Exchange[JmsMessage: Camel]
In 2.6.0, 2.71, 2.8.0 it fails:
2012-03-13 12:02:08,327 [Consumer[start]] DEBUG SendProcessor - >>>> Endpoint[seda://failover2] Exchange[Message: [Body is null]]
2012-03-13 12:02:08,327 [eda://failover1] ERROR SedaConsumer - Error processing exchange. Exchange[Message: [Body is null]]. Caused by: [java.io.IOException - forced exception for test]
java.io.IOException: forced exception for test
at LoadBalancerRouteTest$1$2.process(LoadBalancerRouteTest.java:55)...
2012-03-13 12:02:08,327 [eda://failover2] DEBUG SendProcessor - >>>> Endpoint[mock://failover2] Exchange[Message: [Body is null]]
2012-03-13 12:02:08,328 [eda://failover2] DEBUG MockEndpoint - mock://failover2 >>>> 1 : Exchange[Message: [Body is null]] with body: Hello
2012-03-13 12:02:08,328 [main ] DEBUG MockEndpoint - Took 6 millis to complete latch
2012-03-13 12:02:08,328 [eda://failover2] DEBUG Pipeline - Message exchange has failed: so breaking out of pipeline for exchange: Exchange[Message: [Body is null]] Fault: Message: [Body is null]
Test Case
We have a very nice test case from our customer, so it's as easy as mvn clean install. At moment, I have the attached test case set to 2.8.0-fuse-02-05.