Search in sources :

Example 1 with CustomException

use of org.apache.camel.component.cxf.jaxrs.testbean.CustomException in project camel by apache.

the class CxfRsSpringConsumerTest method createRouteBuilder.

protected RouteBuilder createRouteBuilder() throws Exception {
    final Processor testProcessor = new Processor() {

        public void process(Exchange exchange) throws Exception {
            // just throw the CustomException here
            throw new CustomException("Here is the exception");
        }
    };
    final Processor responseProcessor = new Processor() {

        public void process(Exchange exchange) throws Exception {
            // do something else with the request properties as usual
            // do something else with the response
            exchange.getOut().getBody(Customer.class).setId(246);
        }
    };
    return new RouteBuilder() {

        public void configure() {
            errorHandler(new NoErrorHandlerBuilder());
            from("cxfrs://bean://rsServer").process(testProcessor);
            from("cxfrs://bean://rsServer2").process(testProcessor);
            from("cxfrs://bean://rsServerInvoke?performInvocation=true").process(responseProcessor);
        }
    };
}
Also used : Exchange(org.apache.camel.Exchange) Processor(org.apache.camel.Processor) RouteBuilder(org.apache.camel.builder.RouteBuilder) Customer(org.apache.camel.component.cxf.jaxrs.testbean.Customer) NoErrorHandlerBuilder(org.apache.camel.builder.NoErrorHandlerBuilder) CustomException(org.apache.camel.component.cxf.jaxrs.testbean.CustomException)

Aggregations

Exchange (org.apache.camel.Exchange)1 Processor (org.apache.camel.Processor)1 NoErrorHandlerBuilder (org.apache.camel.builder.NoErrorHandlerBuilder)1 RouteBuilder (org.apache.camel.builder.RouteBuilder)1 CustomException (org.apache.camel.component.cxf.jaxrs.testbean.CustomException)1 Customer (org.apache.camel.component.cxf.jaxrs.testbean.Customer)1