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 405e288 CAMEL-16861: Cleanup and update EIP docs 405e288 is described below commit 405e28845892098ddf24854718e16f59089ce539 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Wed Sep 15 18:04:07 2021 +0200 CAMEL-16861: Cleanup and update EIP docs --- .../src/main/docs/modules/eips/nav.adoc | 5 +- .../main/docs/modules/eips/pages/choice-eip.adoc | 15 ++--- .../eips/pages/composed-message-processor.adoc | 15 ++--- .../eips/pages/content-based-router-eip.adoc | 77 ---------------------- .../pages/enterprise-integration-patterns.adoc | 2 +- .../main/docs/modules/eips/pages/filter-eip.adoc | 2 +- .../modules/eips/pages/message-dispatcher.adoc | 2 +- .../main/docs/modules/eips/pages/normalizer.adoc | 2 +- .../modules/ROOT/pages/advice-with.adoc | 2 +- .../modules/ROOT/pages/backlog-tracer.adoc | 2 +- docs/user-manual/modules/ROOT/pages/java-dsl.adoc | 2 +- docs/user-manual/modules/ROOT/pages/predicate.adoc | 4 +- .../modules/ROOT/pages/stream-caching.adoc | 3 +- .../modules/faq/pages/what-is-a-router.adoc | 2 +- ...se-when-or-otherwise-in-a-java-camel-route.adoc | 12 ++-- 15 files changed, 33 insertions(+), 114 deletions(-) diff --git a/core/camel-core-engine/src/main/docs/modules/eips/nav.adoc b/core/camel-core-engine/src/main/docs/modules/eips/nav.adoc index f4d3d11..f44afb7 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/nav.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/nav.adoc @@ -3,16 +3,15 @@ * xref:eips:enterprise-integration-patterns.adoc[Enterprise Integration Patterns] ** xref:eips:aggregate-eip.adoc[Aggregate] - ** xref:eips:batch-config-eip.adoc[Batch-config] + ** xref:eips:batch-config-eip.adoc[Batch Config] ** xref:eips:bean-eip.adoc[Bean] ** xref:eips:change-data-capture.adoc[Change Data Capture] ** xref:eips:channel-adapter.adoc[Channel Adapter] - ** xref:eips:choice-eip.adoc[Choice] + ** xref:eips:choice-eip.adoc[Content Based Router] ** xref:eips:circuitBreaker-eip.adoc[Circuit Breaker] ** xref:eips:claimCheck-eip.adoc[Claim Check] ** xref:eips:competing-consumers.adoc[Competing Consumers] ** xref:eips:composed-message-processor.adoc[Composed Message Processor] - ** xref:eips:content-based-router-eip.adoc[Content Based Router] ** xref:eips:content-enricher.adoc[Content Enricher] ** xref:eips:content-filter-eip.adoc[Content Filter] ** xref:eips:convertBodyTo-eip.adoc[Convert Body To] diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/choice-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/choice-eip.adoc index d3c542b..522c841 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/choice-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/choice-eip.adoc @@ -76,8 +76,7 @@ When using the Choice EIP in the Java DSL you may have a situation where the com `when()` or `otherwise()` statements. For example as shown in the route below where we use the -xref:loadBalance-eip.adoc[Load Balancer] inside the -xref:content-based-router-eip.adoc[Content Based Router] in the first when: +xref:loadBalance-eip.adoc[Load Balancer] EIP inside the Choice EIP in the first when: *Code will not compile* @@ -91,7 +90,7 @@ from("direct:start") .to("mock:result"); ---- -Well the first issue is that the xref:loadBalance-eip.adoc[Load Balancer] +Well the first issue is that the xref:loadBalance-eip.adoc[Load Balancer] EIP uses the additional routing to know what to use in the load balancing. In this example that would be the: @@ -120,13 +119,11 @@ However, the code will still not compile. The reason is we have stretched how far we can take the good old Java language in terms of xref:latest@manual:ROOT:dsl.adoc[DSL]. In a more dynamic or modern language such as Kotlin or Groovy you would be able to let it be stack based, so the `.end()` will pop the last type of the -stack, and you would return to the scope of the -xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based Router]. +stack, and you would return to the scope of the Choice EIP. That's not doable in Java. So we need to help Java a bit, which you do by using `.endChoice()`, which tells Camel to "pop the stack" and return -to the scope of the xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based -Router]. +to the scope of the Choice EIP. *Code compiles* @@ -143,10 +140,10 @@ from("direct:start") You only need to use `.endChoice()` when using certain xref:{eip-vc}:eips:enterprise-integration-patterns.adoc[EIP]s which often have additional methods to configure or as part of the EIP itself. For example the -xref:split-eip.adoc[Splitter] EIP has a sub-route which denotes the +xref:split-eip.adoc[Split] EIP has a sub-route which denotes the routing of each _splitted_ message. You would also have to use `.endChoice()` to indicate the end of the sub-route and to return -to the xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based Router]. +to the Choice EIP. ==== Still problems diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/composed-message-processor.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/composed-message-processor.adoc index 7571b58..f1ff30b 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/composed-message-processor.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/composed-message-processor.adoc @@ -16,20 +16,19 @@ and re-aggregates the responses back into a single message. With Camel this pattern is implemented by the xref:split-eip.adoc[Splitter] which has built-in aggregation to re-aggregate the responses back into a single message. -== Sample +== Example -This sample uses the xref:split-eip.adoc[Splitter] as composed message processor to process each splitted message, -aggregate and return a combined single response. +This example uses the xref:split-eip.adoc[Split] EIP as composed message processor to process each split message, +aggregate and return a single combined response. -The route and the code comments below explains how you can use the xref:split-eip.adoc[Splitter] to -split each message to sub-message which are processed individuallay and then combined back into -a single response message via the custom ``aggregationStrategy` (`MyOrderStategy`), which -then are the output of the splitter, that are then further processed at the end of the route. +The route and the code comments below explains how you can use the xref:split-eip.adoc[Split] EIP to +split each message to sub-message which are processed individually and then combined back into +a single response message via the custom `AggregationStrategy` (`MyOrderStrategy`), as the output from the Split EIP. [source,java] ---- // this routes starts from the direct:start endpoint -// the body is then splitted based on @ separator +// the body is then split based on @ separator // the splitter in Camel supports InOut as well and for that we need // to be able to aggregate what response we need to send back, so we provide our // own strategy with the class MyOrderStrategy. diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/content-based-router-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/content-based-router-eip.adoc deleted file mode 100644 index 820bf2c..0000000 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/content-based-router-eip.adoc +++ /dev/null @@ -1,77 +0,0 @@ -[[contentBasedRouter-eip]] -= Content Based Router - -The -http://www.enterpriseintegrationpatterns.com/ContentBasedRouter.html[Content -Based Router] from the xref:enterprise-integration-patterns.adoc[EIP -patterns] allows you to route messages to the correct destination based -on the contents of the message exchanges. - -image::eip/ContentBasedRouter.gif[image] - -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 xref:latest@manual:ROOT:predicate.adoc[Predicate] expressions - -[source,java] ----- -RouteBuilder builder = new RouteBuilder() { - public void configure() { - errorHandler(deadLetterChannel("mock:error")); - - from("direct:a") - .choice() - .when(header("foo").isEqualTo("bar")) - .to("direct:b") - .when(header("foo").isEqualTo("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`. -==== - -== Using the xref:latest@manual:ROOT:spring-xml-extensions.adoc[Spring XML Extensions] - -[source,java] ----- -<camelContext errorHandlerRef="errorHandler" xmlns="http://camel.apache.org/schema/spring"> - <route> - <from uri="direct:a"/> - <choice> - <when> - <xpath>$foo = 'bar'</xpath> - <to uri="direct:b"/> - </when> - <when> - <xpath>$foo = 'cheese'</xpath> - <to uri="direct:c"/> - </when> - <otherwise> - <to uri="direct:d"/> - </otherwise> - </choice> - </route> -</camelContext> ----- - -For further examples of this pattern in use you could look at the -https://github.com/apache/camel/blob/main/core/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java[junit test case]. - -[[ContentBasedRouter-UsingThisPattern]] -== Using This Pattern - -If you would like to use this EIP Pattern then please read the -xref:latest@manual:ROOT:getting-started.adoc[Getting Started]. You may also find the -xref:latest@manual:ROOT:architecture.adoc[Architecture] useful particularly the description -of xref:latest@manual:ROOT:endpoint.adoc[Endpoint] and xref:latest@manual:ROOT:uris.adoc[URIs]. Then you could -try out some of the xref:latest@manual:ROOT:examples.adoc[Examples] first before trying -this pattern out. diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/enterprise-integration-patterns.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/enterprise-integration-patterns.adoc index d01175b..1dba6a8 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/enterprise-integration-patterns.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/enterprise-integration-patterns.adoc @@ -116,7 +116,7 @@ when a message should be considered stale and thus shouldn’t be processed? [width="100%",cols="10%,10%,80%",] |======================================================================= a|image::eip/ContentBasedRouterIcon.gif[image] -|xref:content-based-router-eip.adoc[Content Based Router] |How do we handle +|xref:choice-eip.adoc[Content Based Router] |How do we handle a situation where the implementation of a single logical function (e.g., inventory check) is spread across multiple physical systems? diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/filter-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/filter-eip.adoc index ad43501..61eab1a 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/filter-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/filter-eip.adoc @@ -80,7 +80,7 @@ And the example in XML: Stop is a bit different than a message filter as it will filter out all messages and end the route entirely (filter only applies to its child processor). Stop is convenient to use in a -xref:content-based-router-eip.adoc[Content Based Router] when you for +xref:choice-eip.adoc[Content Based Router] when you for example need to stop further processing in one of the predicates. In the example below we do not want to route messages any further that 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 c858e0a..c2b92a7 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,5 +11,5 @@ image::eip/MessageDispatcher.gif[image] You can use a component like JMS with selectors to implement a xref:selective-consumer.adoc[Selective Consumer] as the Message Dispatcher implementation. Or you can use an xref:message-endpoint.adoc[Message Endpoint] -as the Message Dispatcher itself and then use a xref:content-based-router-eip.adoc[Content Based Router] +as the Message Dispatcher itself and then use a xref:choice-eip.adoc[Content Based Router] as the Message Dispatcher. diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/normalizer.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/normalizer.adoc index abf9333..d375132 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/normalizer.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/normalizer.adoc @@ -10,7 +10,7 @@ but arrive in different formats. The normalizer transforms the incoming messages image::eip/NormalizerDetail.gif[image] -In Apache Camel, you can implement the normalizer pattern by combining a xref:content-based-router-eip.adoc[Content Based Router], +In Apache Camel, you can implement the normalizer pattern by combining a xref:choice-eip.adoc[Content Based Router], which detects the incoming message's format, with a collection of different xref:message-translator.adoc[Message Translator]'s, which transform the different incoming formats into a common format. diff --git a/docs/user-manual/modules/ROOT/pages/advice-with.adoc b/docs/user-manual/modules/ROOT/pages/advice-with.adoc index bf1fd24..75dccb1 100644 --- a/docs/user-manual/modules/ROOT/pages/advice-with.adoc +++ b/docs/user-manual/modules/ROOT/pages/advice-with.adoc @@ -358,7 +358,7 @@ is processed before calling the splitter. This means the message body is appende The `weaveByToUri` is a handy method that makes it easy to _weave_ a Camel route that send messages to a given endpoint URI or pattern. -Given the following route having two branches in the xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based Router] EIP: +Given the following route having two branches in the xref:{eip-vc}:eips:choice-eip.adoc[Content Based Router] EIP: [source,java] ---- diff --git a/docs/user-manual/modules/ROOT/pages/backlog-tracer.adoc b/docs/user-manual/modules/ROOT/pages/backlog-tracer.adoc index 3435d1f..2b96698 100644 --- a/docs/user-manual/modules/ROOT/pages/backlog-tracer.adoc +++ b/docs/user-manual/modules/ROOT/pages/backlog-tracer.adoc @@ -26,7 +26,7 @@ xref:tracer.adoc[Tracer] is event based and logs the messages as they happen (or route to another Camel destination). Also the xref:tracer.adoc[Tracer] has more fine grained events where it dives into xref:{eip-vc}:eips:enterprise-integration-patterns.adoc[EIP]s such as the -xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based Router] and traces the +xref:{eip-vc}:eips:choice-eip.adoc[Content Based Router] and traces the when/otherwise(s). Though the xref:tracer.adoc[Tracer] has much more complicated logic to handle this (there is some edge-cases where this may not work). The BacklogTracer allows you to pull the messages from diff --git a/docs/user-manual/modules/ROOT/pages/java-dsl.adoc b/docs/user-manual/modules/ROOT/pages/java-dsl.adoc index cf1ee08..680775e 100644 --- a/docs/user-manual/modules/ROOT/pages/java-dsl.adoc +++ b/docs/user-manual/modules/ROOT/pages/java-dsl.adoc @@ -51,7 +51,7 @@ In the example above we have a single route, which pickup files (the `from`). from("file:src/data?noop=true") --------------------------------------- -Then we use the xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based Router] EIP +Then we use the xref:{eip-vc}:eips:choice-eip.adoc[Content Based Router] EIP (the `choice`) to route the message whether the person is from London or not. [source,java] diff --git a/docs/user-manual/modules/ROOT/pages/predicate.adoc b/docs/user-manual/modules/ROOT/pages/predicate.adoc index 1212c75..1d85ef3 100644 --- a/docs/user-manual/modules/ROOT/pages/predicate.adoc +++ b/docs/user-manual/modules/ROOT/pages/predicate.adoc @@ -3,7 +3,7 @@ xref:expression.adoc[Expressions] and Predicates can then be used to create the various xref:{eip-vc}:eips:enterprise-integration-patterns.adoc[Enterprise -Integration Patterns] in the xref:dsl.adoc[DSL] like with the xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based Router] EIP. +Integration Patterns] in the xref:dsl.adoc[DSL] like with the xref:{eip-vc}:eips:choice-eip.adoc[Content Based Router] EIP. To support dynamic rules Camel supports pluggable https://www.javadoc.io/doc/org.apache.camel/camel-api/current/org/apache/camel/Predicate.html[Predicate] @@ -36,7 +36,7 @@ powerful as it is often used to control the routing of message in which path they should be routed. A simple example is to route an xref:exchange.adoc[Exchange] based on a -header value with the xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based Router] EIP: +header value with the xref:{eip-vc}:eips:choice-eip.adoc[Content Based Router] EIP: [source,java] ---- diff --git a/docs/user-manual/modules/ROOT/pages/stream-caching.adoc b/docs/user-manual/modules/ROOT/pages/stream-caching.adoc index 394dd26..9a5a610 100644 --- a/docs/user-manual/modules/ROOT/pages/stream-caching.adoc +++ b/docs/user-manual/modules/ROOT/pages/stream-caching.adoc @@ -10,7 +10,8 @@ Streams are cached in memory. However, for large stream messages (over 128 KB) w *StreamCache - Affecting the message payload* The `StreamCache` will affect your payload object as it will replace the `Stream` payload with a `org.apache.camel.StreamCache` object. -This `StreamCache` is capable of being re-readable and thus possible to better be routed within Camel using redelivery or xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based Router] or the likes. +This `StreamCache` is capable of being re-readable and thus possible to better be routed within Camel using redelivery +or xref:{eip-vc}:eips:choice-eip.adoc[Content Based Router] or the likes. However, to not change the payload under the covers without the end user really knowing then stream caching is by default disabled. ==== diff --git a/docs/user-manual/modules/faq/pages/what-is-a-router.adoc b/docs/user-manual/modules/faq/pages/what-is-a-router.adoc index 9d2b1c3..2217bf7 100644 --- a/docs/user-manual/modules/faq/pages/what-is-a-router.adoc +++ b/docs/user-manual/modules/faq/pages/what-is-a-router.adoc @@ -11,7 +11,7 @@ xref:{eip-vc}:eips:enterprise-integration-patterns.adoc[Enterprise Integration Patterns]. For example a router could implement the -xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based Router] pattern, to route +xref:{eip-vc}:eips:choice-eip.adoc[Content Based Router] pattern, to route from an endpoint to one or more destination endpoints using a xref:ROOT:predicate.adoc[Predicate] based on the message content. diff --git a/docs/user-manual/modules/faq/pages/why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.adoc b/docs/user-manual/modules/faq/pages/why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.adoc index 306ec53..888090b 100644 --- a/docs/user-manual/modules/faq/pages/why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.adoc +++ b/docs/user-manual/modules/faq/pages/why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.adoc @@ -1,7 +1,7 @@ [[WhycanInotusewhenorotherwiseinaJavaCamelroute-WhycanInotusewhenotherwiseinaJavaCamelroute]] = Why can I not use when/otherwise in a Java Camel route? -When using the xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based Router] in +When using the xref:{eip-vc}:eips:choice-eip.adoc[Content Based Router] in the Java DSL you may have a situation where the compiler will not accept the following `when()` or `otherwise()` statement. @@ -10,12 +10,12 @@ the following `when()` or `otherwise()` statement. **Quick tip** Use `.endChoice()` to return "back" to the -xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based Router]. +xref:{eip-vc}:eips:choice-eip.adoc[Content Based Router]. ==== For example as shown in the route below where we use the xref:{eip-vc}:eips:loadBalance-eip.adoc[Load Balancer] inside the -xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based Router] in the first when: +xref:{eip-vc}:eips:choice-eip.adoc[Content Based Router] in the first when: *Code will not compile* @@ -59,10 +59,10 @@ xref:ROOT:dsl.adoc[DSL]. In a more modern language such as Scala or Groovy you would be able to let it be stack based, so the `.end()` will pop the last type of the stack, and you would return back to the scope of the -xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based Router]. However that's not +xref:{eip-vc}:eips:choice-eip.adoc[Content Based Router]. However that's not easily doable in Java. So we need to help Java a bit, which you do by using `.endChoice()`, which tells Camel to "pop the stack" and return -back to the scope of the xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based +back to the scope of the xref:{eip-vc}:eips:choice-eip.adoc[Content Based Router]. *Code compiles* @@ -84,7 +84,7 @@ xref:{eip-vc}:eips:enterprise-integration-patterns.adoc[EIP] itself. For example xref:{eip-vc}:eips:split-eip.adoc[Splitter] EIP has a sub-route which denotes the routing of each splitted message. You would also have to use `.endChoice()` to indicate the end of the sub-route and to return back -to the xref:{eip-vc}:eips:content-based-router-eip.adoc[Content Based Router]. Note +to the xref:{eip-vc}:eips:choice-eip.adoc[Content Based Router]. Note `.endChoice()` is *Since Camel 2.7*. [[WhycanInotusewhenorotherwiseinaJavaCamelroute-Stillproblems]]