I have this Route defined:

 from("cxf:bean:hubws?dataFormat=MESSAGE").streamCaching()
             .onException(Exception.class).process(new
Log()).to("file:c:/camel-output/fail/")
              .bean(LogMq.class, "logStart")
              .bean(AddIpBean.class).bean(SetRoutingKey.class).choice()
              .when(header(ROUTING_KEY).contains(ROUTING_BD)).to("bdws")
              .when(header(ROUTING_KEY).contains(ROUTING_BEC)).to("becws")
             
.when(header(ROUTING_KEY).contains(ROUTING_SDC)).to("sdcws").otherwise().to("file:/fja/")

Work fine, until i added .onException, i get this error:

 org.apache.camel.FailedToCreateRouteException: Failed to create route
route1 at: 
 From[cxf:bean:hubws?dataFormat=MESSAGE] <<< in route:
Route(route1)[[From[cxf:bean:hubws?dataFormat=MESSAGE]] -> 
[... because of Route route1 has no output processors. You need to add
outputs to the route such as to("log:foo").

I all want is to come into this class, if some off my beans throw a
exception.

public class Log  extends Exception implements Processor  {
    public static final String ROUTING_KEY = "datacentral";
  
    @Override
    public void process(Exchange exchange) throws Exception {
    
        List<MessageHistory> list = CastUtils.cast((List<?>)
exchange.getProperty(Exchange.MESSAGE_HISTORY, List.class));
     
        System.out.println("FJA");
        
    }

   
}

Is this the way to do it, and if it is, what is wrong whith my routing. ?

Frank

         
                   



--
View this message in context: 
http://camel.465427.n5.nabble.com/onException-You-need-to-add-outputs-to-the-route-such-as-to-log-foo-tp5752202.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to