You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Petr Juza (JIRA)" <ji...@apache.org> on 2013/04/21 21:51:15 UTC

[jira] [Created] (CAMEL-6300) AdviceWith doesn't work with doTry

Petr Juza created CAMEL-6300:
--------------------------------

             Summary: AdviceWith doesn't work with doTry
                 Key: CAMEL-6300
                 URL: https://issues.apache.org/jira/browse/CAMEL-6300
             Project: Camel
          Issue Type: Bug
          Components: tests
    Affects Versions: 2.10.4
         Environment: Java 6, macos
            Reporter: Petr Juza
             Fix For: 2.10.5, 2.11.1


I have the following route definition:
{code}
        from("direct:billing_" + operation)
                .routeId(getRouteId(operation))
                .errorHandler(noErrorHandler()) // propagate exceptions to the parent route

                .validate(body().isInstanceOf(
                        com.cleverlance.cleverbss.integration.modules.in.customer.model.Customer.class))

                .beanRef(BILLING_CUSTOMER_ROUTE_BEAN, "createRequestFor" + WordUtils.capitalize(operation))

                 // SetCustomer -> XML
                .marshal(jaxbIn)

                .doTry()
                    .to(uri + "?messageSender=#billingSender").id("toURI")
                .doCatch(AlreadyExistsException.class)
                    .setProperty(exPropertyName, property(Exchange.EXCEPTION_CAUGHT))
                .end()

                .choice()
                    .when(property(exPropertyName).isNull())

                    // XML -> SetCustomerResponse
                    .unmarshal(jaxbOut)
                .endChoice();
{code}

And I would like to replace TO in the tests:
{code}
        getCamelContext().getRouteDefinition(BillingCustomerRoutes.ROUTE_ID_UPDATE_CUSTOMER)
                .adviceWith(getCamelContext(), new AdviceWithRouteBuilder() {
                    @Override
                    public void configure() throws Exception {                        weaveByType(ToDefinition.class).replace().process(new Processor() {
                            @Override
                            public void process(Exchange exchange) throws Exception {
                                throw new AlreadyExistsException("msg", new AlreadyExists());
                            }
                        });
                    }
                });
{code}

When I use weaveById("toURI") or weaveByToString(), it doesn't work neither.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira