On 15/11/2007, Amah Ahite <[EMAIL PROTECTED]> wrote:
> Hi,
> I am very new to Camel framework
Welcome Amah!
> and I want to configure the default error
> channel.
A perfectly reasonable suggestion :)
> In the following code I am trying to rediect failed exchanges to the
> mock:err endpoint but this does not work.
>
> public void testException() throws Exception{
> DefaultCamelContext ctx = new DefaultCamelContext();
> ctx.addRoutes(new RouteBuilder(){
> @Override
> public void configure() throws Exception {
> errorHandler(deadLetterChannel("mock:err"));
> from("seda:a").process(new Processor(){
> public void process(Exchange
> exchange) throws Exception {
> throw new Exception("Test
> exception");
> }
> });
> }
> });
>
> MockEndpoint mock = (MockEndpoint)
> ctx.getEndpoint("mock:err");
> mock.expectedMessageCount(1);
>
> ctx.start();
> CamelTemplate<Exchange> template = new
> CamelTemplate<Exchange>(ctx);
> template.sendBody("seda:a", "Test message");
> mock.assertIsSatisfied();
> ctx.stop();
> }
>
>
> I am using camel 1.2.0 and I noticed the issue
> (https://issues.apache.org/activemq/browse/CAMEL-191) but I dont know
> whether the test failure is related to it.
>
> Please can you tell me if I'am missing something?
No you're not - this looks like a bug.
It turned out that the error handler specified outside of a route
wasn't correctly being inherited any more - my bad, I think I broke
something when the JAXB refactoring went on. I've added a slightly
refactored version of your test case (AmahDeadLetterTest) to
camel-core which reproduced the issue perfectly - and I've applied a
fix now thanks!
--
James
-------
http://macstrac.blogspot.com/
Open Source SOA
http://open.iona.com