This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new cd3aaf8 CAMEL-16861: Cleanup and update EIP docs
cd3aaf8 is described below
commit cd3aaf815ec36df10b1f41594eb3b05aee2c6183
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Oct 7 07:45:32 2021 +0200
CAMEL-16861: Cleanup and update EIP docs
---
.../modules/eips/pages/message-dispatcher.adoc | 2 +-
.../docs/modules/eips/pages/message-router.adoc | 85 ++++++++++------------
2 files changed, 39 insertions(+), 48 deletions(-)
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/message-dispatcher.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/message-dispatcher.adoc
index 0c36c51..49bbb81 100644
---
a/core/camel-core-engine/src/main/docs/modules/eips/pages/message-dispatcher.adoc
+++
b/core/camel-core-engine/src/main/docs/modules/eips/pages/message-dispatcher.adoc
@@ -11,6 +11,6 @@ In Camel the Message Dispatcher can be archived in different
ways such as:
* You can use a component like xref:components::jms-component.adoc[JMS] with
selectors
to implement a xref:selective-consumer.adoc[Selective Consumer] as the Message
Dispatcher implementation.
-* Or you can use a xref:message-endpoint.adoc[Message Endpoint] as the Message
Dispatcher itself, and
+* Or you can use a xref:message-endpoint.adoc[Message Endpoint] as the Message
Dispatcher itself, or
combine this with the xref:choice-eip.adoc[Content Based Router] as the
Message Dispatcher.
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/message-router.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/message-router.adoc
index 443e8b5..85cda6b 100644
---
a/core/camel-core-engine/src/main/docs/modules/eips/pages/message-router.adoc
+++
b/core/camel-core-engine/src/main/docs/modules/eips/pages/message-router.adoc
@@ -8,63 +8,54 @@ then choose the right output destination.
image::eip/MessageRouter.gif[image]
-The following example shows how to route a request from an input
-*queue:a* endpoint to either *queue:b*, *queue:c* or *queue:d* depending
-on the evaluation of various xref:latest@manual:ROOT:predicate.adoc[Predicate]
expressions
+In Camel the Message Router can be archived in different ways such as:
+
+* You can use the xref:choice-eip.adoc[Content Based Router] to evaluate and
choose the output destination.
+* The xref:routingSlip-eip.adoc[Routing Slip] and
xref:dynamicRouter-eip.adoc[Dynamic Router] EIPs can also be used for choosing
which destination to route messages.
+
+The xref:choice-eip.adoc[Content Based Router] is recommended to use when you
have multiple predicates to evaluate
+where to send the message.
+
+The xref:routingSlip-eip.adoc[Routing Slip] and
xref:dynamicRouter-eip.adoc[Dynamic Router] are arguably
+more advanced where you do not use predicates to choose where to route the
message, but use an expression
+to choose where the message should go.
-== Examples
+== Example
The following example shows how to route a request from an input
-*direct:a* endpoint to either *direct:b*, *direct:c* or *direct:d* depending on
-the evaluation of various xref:latest@manual:ROOT:predicate.adoc[Predicate]
expressions
+direct:a endpoint to either direct:b, direct:c, or direct:d depending on
+the evaluation of various xref:latest@manual:ROOT:predicate.adoc[Predicate]:
[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");
- }
-};
+from("direct:a")
+ .choice()
+ .when(simple("${header.foo} == 'bar'"))
+ .to("direct:b")
+ .when(simple("${header.foo} == 'cheese'"))
+ .to("direct:c")
+ .otherwise()
+ .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:
[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>
+<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>
----
-
-[[MessageRouter-Choicewithoutotherwise]]
-== Choice without otherwise
-
-If you use a `choice` without adding an `otherwise`, any unmatched
-exchanges will be dropped by default.
-