camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Best way to throw away an exchange in a route in an otherwise() case
Date Sat, 17 Oct 2009 06:17:22 GMT
On Sat, Oct 17, 2009 at 2:02 AM, jonathanq <jquail@abebooks.com> wrote:
>
> I think I found the solution in the documentation (that's what I get for
> finally posting a question - never fails I will find the answer 10 minutes
> later).
>
> This is waht I have now:
>
> from("direct:incoming")
>            .choice()
>              .when(header("status").isEqualTo("1"))
>                .process(status1processor)
>              .when(header("status").isEqualTo("2))
>                .process(status2processor)
>              .otherwise().process(unknownstatusprocessor).stop()
>            .end()
>            .process(someOtherProcessor)
>            .to("mock:outgoing);
>
> Specifically - I added the .stop() to the otherwise() path.
>
> .otherwise().process(getUnknownEmailStatusProcessor()).stop()
>
> Is that the correct way to do it?  My unit tests seem to say so..but I
> wanted to ask the experts to be sure.

Yeah stop() is the right way to do so. Its also easy to understand
what it does :)

The message filter is another way (a more classic EIP solution)
http://camel.apache.org/message-filter.html


> --
> View this message in context: http://www.nabble.com/Best-way-to-throw-away-an-exchange-in-a-route-in-an-otherwise%28%29-case-tp25933807p25933965.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message