camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Petr Juza (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-6300) AdviceWith doesn't work with doTry
Date Sun, 21 Apr 2013 19:53:15 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-6300?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Petr Juza updated CAMEL-6300:
-----------------------------

    Description: 
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.

  was:
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.

    
> 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

Mime
View raw message