camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boday <ben.o...@initekconsulting.com>
Subject Re: deadLetterChannel with enrich
Date Fri, 03 Jun 2011 21:29:00 GMT
hmmm...I just tried this and it worked as expected...I made a few tweaks in
place of your bean/aggregator classes...

	@EndpointInject(uri = "mock:outbox")
	protected MockEndpoint mock;
	
	@Test
	public void test() throws Exception {
		mock.expectedMessageCount(0);
		template.sendBody("direct:start", "message");
		mock.assertIsSatisfied();
	}

	@Override
	protected RouteBuilder createRouteBuilder() throws Exception {
		return new RouteBuilder() {
			@Override
			public void configure() throws Exception {

			
errorHandler(deadLetterChannel("direct:deadChannel").disableRedelivery());

				from("direct:start")
				  .log("before enriching")
				  .enrich("direct:enrich", new MyAggregator())
				  .log("done enriching")
				  .to("mock:outbox");

				from("direct:enrich")
				  .throwException(new Exception("test"));

				from("direct:deadChannel")
				  .log("Received dead message: ${body}")
				  .to("mock:dead");
			}
		};
	}



gmcfall wrote:
> 
> Hi,
> 
> I have the following configuration:
> 
> 	errorHandler(
> 		deadLetterChannel("direct:deadChannel")
> 			.disableRedelivery()
> 	);
> 				
> 			
> 	from("direct:inbox")
> 		.enrich("direct:enrich", new MyAggregationStrategy())
> 		.log("done enriching")
> 		.to("mock:outbox");
> 	
> 	from("direct:enrich")
> 		.bean(new MockService());
> 	
> 	from("direct:deadChannel")
> 		.log("Received dead message: ${body}")
> 		.to("mock:dead");
> 
> 
> The MockService bean throws an Exception.
> With this configuration, a message sent to "direct:inbox" is delivered
> to the "mock:dead" endpoint, as expected.
> But, the message is also delivered to "mock:outbox", contrary to my
> expectaction.
> 
> How do I ensure that the route is ended after the message is delivered
> to the dead letter channel?
> 


-----
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: http://camel.465427.n5.nabble.com/deadLetterChannel-with-enrich-tp4452052p4452628.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message