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 df6c04df02c55a0db4a100f6bf996e8ce591c3e0 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Sat Apr 10 16:59:21 2021 +0200 Regen and sync deps --- camel-dependencies/pom.xml | 2 +- .../org/apache/camel/catalog/docs/choice-eip.adoc | 46 +++++++++++++++++++--- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/camel-dependencies/pom.xml b/camel-dependencies/pom.xml index a5d0cee..f26c725 100644 --- a/camel-dependencies/pom.xml +++ b/camel-dependencies/pom.xml @@ -70,7 +70,7 @@ <avro-version>1.10.2</avro-version> <awaitility-version>4.0.3</awaitility-version> <aws-java-sdk-swf-libs>1.11.22</aws-java-sdk-swf-libs> - <aws-java-sdk2-version>2.16.38</aws-java-sdk2-version> + <aws-java-sdk2-version>2.16.39</aws-java-sdk2-version> <aws-xray-version>2.6.1</aws-xray-version> <axiom-version>1.2.14</axiom-version> <azure-sdk-bom-version>1.0.2</azure-sdk-bom-version> diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/choice-eip.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/choice-eip.adoc index 9000a01..a431005 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/choice-eip.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/choice-eip.adoc @@ -46,14 +46,9 @@ RouteBuilder builder = new RouteBuilder() { .to("direct:d"); } }; + ---- -[TIP] -==== -See xref:latest@manual:faq:why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.adoc[Why -can I not use when or otherwise in a Java Camel route] if you have -problems with the Java DSL, accepting using `when` or `otherwise`. -==== And the same example using XML: @@ -78,3 +73,42 @@ And the same example using XML: </route> </camelContext> ---- + +== Usage of endChoice and end +Usage of `endChoice` is not mandatory. However, It should be used whenever you want to return back control to `choice()` dsl so that you can add subsequent `when` and `otherwise` to the choice dsl. +If you want to end entire `choice()` block use `end()`. + +=== Example + +[source,java] +---- + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:start") + .choice() + .when(body().contains("Camel")) + .multicast() + .to("mock:foo") + .to("mock:bar") + .endChoice() //we need to use endChoice to tell Java DSL to return scope back to the choice DSL. + .otherwise() + .to("mock:result"); + } + }; + } + +---- + +Another example is explained in the TIP below. + +[TIP] +==== +See xref:latest@manual:faq:why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.adoc[Why +can I not use when or otherwise in a Java Camel route] if you have +problems with the Java DSL, accepting using `when` or `otherwise`. +==== +