camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: .onException You need to add outputs to the route such as to("log:foo")
Date Thu, 12 Jun 2014 14:13:35 GMT
Hi

Next time use the @user mailing list / user forum.

Your problem is that you need to tell Camel when onException ends, so
add an .end() in the route. And after that the regular route starts.

On Thu, Jun 12, 2014 at 4:01 PM, Frankiboy <mail.to.frankj@gmail.com> wrote:
> 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.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message