Hi there

I would like to nest exception handling and choice like this:

from(queue)
    .doTry()
        .choice()
            .when().xpath("/StaticDataServiceRequest")
            .when().xpath("/StaticDataServicePing").bean(handler,
"processPingRequest")
            .otherwise().throwException(new
StaticDataServiceHandlerException("unknown request type"))
        .end()
    .doCatch(Exception.class) // fails to compile
        .handled(false)
        .bean(handler, "processException")
    .end();

of if necessary the other way round:

from(queue)
    .choice()
        .when().xpath("/StaticDataServiceRequest")
            .doTry()
                .bean(handler, "processCacheRequest")
            .doCatch(Exception.class)
                .bean(handler, "processException")
            .end();
        .when().xpath("/StaticDataServicePing")
            .doTry()
                .bean(handler, "processPingRequest")
            .doCatch(Exception.class)
                .bean(handler, "processException")
            .end();
        .otherwise().bean(handler, "processUnknownRequest")
    .end()

In both cases Camel returns a ProcessorExpression at the end of the choice
in the first case and the end of the try in the second, which does not
provide a doCatch. Is there a way to get this combination working?

Thanks in advance
Daniel
-- 
View this message in context: 
http://old.nabble.com/Nested-doTry-and-choice-blocks-tp27512473p27512473.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to