This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit f5090ab0e700fc1b22cfed20bf4615e16958a4c2 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Fri Mar 2 08:16:22 2018 +0100 Added Otherwise EIP docs --- camel-core/src/main/docs/eips/otherwise-eip.adoc | 61 ++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/camel-core/src/main/docs/eips/otherwise-eip.adoc b/camel-core/src/main/docs/eips/otherwise-eip.adoc new file mode 100644 index 0000000..c98b15c --- /dev/null +++ b/camel-core/src/main/docs/eips/otherwise-eip.adoc @@ -0,0 +1,61 @@ +[[otherwise-eip]] +== Otherwise EIP + +The Otherwise EIP is related to http://www.enterpriseintegrationpatterns.com/ContentBasedRouter.html[Content +Based Router] from the link:enterprise-integration-patterns.html[EIP +patterns] + +image:http://www.enterpriseintegrationpatterns.com/img/ContentBasedRouter.gif[image] + +=== Options + +// eip options: START +The Otherwise EIP has no options. +// eip options: END + +=== Examples + +The following example shows how to route a request from an input +*seda:a* endpoint to either *seda:b*, *seda:c* or *seda:d* depending on +the evaluation of various link:predicate.html[Predicate] expressions + +[source,java] +---- +RouteBuilder builder = new RouteBuilder() { + public void configure() { + from("direct:a") + .choice() + .when(simple("${header.foo} == 'bar'")) + .to("direct:b") + .when(simple("${header.foo} == 'cheese'")) + .to("direct:c") + .otherwise() + .to("direct:d"); + } +}; +---- + + +And the same example using XML: + +[source,xml] +---- +<camelContext xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:a"/> + <choice> + <when> + <simple>${header.foo} == 'bar'</simple> + <to uri="direct:b"/> + </when> + <when> + <simple>${header.foo} == 'cheese'</simple> + <to uri="direct:c"/> + </when> + <otherwise> + <to uri="direct:d"/> + </otherwise> + </choice> + </route> +</camelContext> +---- -- To stop receiving notification emails like this one, please contact acosent...@apache.org.