You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Christian Mueller <ch...@gmail.com> on 2013/04/11 22:41:08 UTC

Re: If Exchange was handled(true), only first Processor in doFinally() is executed

What do you mean by "/When handled(true), only first processor from
DIRECT_RESPONSE_PATH_ENDPOINT is executed!/"?

What's the value of DIRECT_RESPONSE_PATH_ENDPOINT?

I created the following unit test which passed:

public class TryCatchFinallyTest extends ContextTestSupport {

    public void testTryCatchCaughtExceptionFinally() throws Exception {
        getMockEndpoint("mock:a").expectedMessageCount(1);
        getMockEndpoint("mock:b").expectedMessageCount(1);
        getMockEndpoint("mock:c").expectedMessageCount(1);
        getMockEndpoint("mock:d").expectedMessageCount(1);
        getMockEndpoint("mock:e").expectedMessageCount(1);
        getMockEndpoint("mock:result").expectedMessageCount(1);

        template.sendBody("direct:start", "Hello World");

        assertMockEndpointsSatisfied();
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from("direct:start")
                    .doTry()
                        .to("mock:a")
                        .throwException(new Exception("boom"))
                    .doCatch(Exception.class)
                        .to("mock:b")
                        .to("mock:c")
                    .doFinally()
                        .to("mock:d")
                        .to("mock:e")
                    .end()
                    .to("mock:result");
            }
        };
    }
}

Best,
Christian



--
View this message in context: http://camel.465427.n5.nabble.com/If-Exchange-was-handled-true-only-first-Processor-in-doFinally-is-executed-tp5730705p5730732.html
Sent from the Camel - Users mailing list archive at Nabble.com.