This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 316bccc Revert "CAMEL-15302: Remove duplicate pages under eip section (#4015)" (#4018) 316bccc is described below commit 316bccccf345758cb8c0e229acfc650619c5795d Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sun Jul 19 08:55:56 2020 +0200 Revert "CAMEL-15302: Remove duplicate pages under eip section (#4015)" (#4018) This reverts commit 519f3a00ba012590d6b369340e3bd6ff2b1afcac. --- .../src/main/docs/modules/eips/nav.adoc | 2 + ...{dynamicRouter-eip.adoc => dynamic-router.adoc} | 9 +-- .../docs/modules/eips/pages/dynamicRouter-eip.adoc | 91 +++++++--------------- .../pages/enterprise-integration-patterns.adoc | 2 +- .../{requestReply-eip.adoc => request-reply.adoc} | 13 +--- .../docs/modules/eips/pages/requestReply-eip.adoc | 1 - 6 files changed, 36 insertions(+), 82 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 7471262..54ad1c9 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 @@ -21,6 +21,7 @@ ** xref:eips:dead-letter-channel.adoc[Dead Letter Channel] ** xref:eips:delay-eip.adoc[Delay] ** xref:eips:durable-subscriber.adoc[Durable Subscriber] + ** xref:eips:dynamic-router.adoc[Dynamic Router] ** xref:eips:dynamicRouter-eip.adoc[Dynamic Router] ** xref:eips:enrich-eip.adoc[Enrich] ** xref:eips:eventDrivenConsumer-eip.adoc[Event Driven Consumer] @@ -71,6 +72,7 @@ ** xref:eips:removeHeaders-eip.adoc[Remove Headers] ** xref:eips:removeProperties-eip.adoc[Remove Properties] ** xref:eips:removeProperty-eip.adoc[Remove Property] + ** xref:eips:request-reply.adoc[Request Reply] ** xref:eips:requestReply-eip.adoc[Request Reply] ** xref:eips:resequence-eip.adoc[Resequence] ** xref:eips:resilience4jConfiguration-eip.adoc[Resilience4j Configuration] diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/dynamicRouter-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/dynamic-router.adoc similarity index 97% copy from core/camel-core-engine/src/main/docs/modules/eips/pages/dynamicRouter-eip.adoc copy to core/camel-core-engine/src/main/docs/modules/eips/pages/dynamic-router.adoc index c404f5f..6bd839f 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/dynamicRouter-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/dynamic-router.adoc @@ -1,9 +1,5 @@ -[[dynamicRouter-eip]] -= Dynamic Router EIP -:docTitle: Dynamic Router -:description: Routes messages based on dynamic rules -:since: -:supportLevel: Stable +[[DynamicRouter-DynamicRouter]] += Dynamic Router The http://www.enterpriseintegrationpatterns.com/DynamicRouter.html[Dynamic @@ -199,3 +195,4 @@ Bean Integration such as * POJO Producing * Spring Remoting * xref:components::bean-component.adoc[Bean] component + diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/dynamicRouter-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/dynamicRouter-eip.adoc index c404f5f..cf3264e 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/dynamicRouter-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/dynamicRouter-eip.adoc @@ -5,11 +5,7 @@ :since: :supportLevel: Stable -The -http://www.enterpriseintegrationpatterns.com/DynamicRouter.html[Dynamic -Router] from the EIP patterns -allows you to route messages while avoiding the dependency of the router -on all possible destinations while maintaining its efficiency. +The http://www.enterpriseintegrationpatterns.com/DynamicRouter.html[Dynamic Router] from the xref:enterprise-integration-patterns.adoc[EIP patterns] allows you to route messages while avoiding the dependency of the router on all possible destinations while maintaining its efficiency. image::eip/DynamicRouter.gif[image] @@ -17,20 +13,11 @@ The `dynamicRouter` in the DSL is similar to a dynamic Routing Slip which evaluates the slip _on-the-fly_. -WARNING: *Beware* -You must ensure the expression used for the `dynamicRouter` such as a -bean, will return `null` to indicate the end. Otherwise the -`dynamicRouter` will keep repeating endlessly. - -[[DynamicRouter-DynamicRouterinCamel2.5onwards]] -== Dynamic Router in Camel 2.5 onwards - -The Dynamic Router will set a -property (Exchange.SLIP_ENDPOINT) on the Exchange -which contains the current endpoint as it advanced though the slip. This -allows you to know how far we have processed in the slip. (It's a slip -because the Dynamic Router implementation is -based on top of Routing Slip). +[IMPORTANT] +.Avoid endless looping +=== +You must ensure the expression used for the `dynamicRouter` such as a bean, will return `null` to indicate the end. Otherwise the `dynamicRouter` will keep repeating endlessly. +=== TIP: See the `cacheSize` option for more details on _how much cache_ to use depending on how many or few unique endpoints are used. @@ -43,13 +30,15 @@ The Dynamic Router EIP supports 3 options which are listed below: |=== | Name | Description | Default | Type | *uriDelimiter* | Sets the uri delimiter to use | , | String -| *ignoreInvalidEndpoints* | Ignore the invalidate endpoint exception when try to create a producer with that endpoint | false | Boolean -| *cacheSize* | Sets the maximum size used by the org.apache.camel.spi.ProducerCache which is used to cache and reuse producers when using this routing slip, when uris are reused. Beware that when using dynamic endpoints then it affects how well the cache can be utilized. If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped and will be stopped and [...] +| *ignoreInvalidEndpoints* | Ignore the invalidate endpoint exception when try to create a producer with that endpoint | | String +| *cacheSize* | Sets the maximum size used by the org.apache.camel.spi.ProducerCache which is used to cache and reuse producers when using this dynamic router, when uris are reused. Beware that when using dynamic endpoints then it affects how well the cache can be utilized. If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped and will be stopped an [...] |=== // eip options: END -[[DynamicRouter-JavaDSL]] -== Java DSL +The Dynamic Router will set the property `Exchange.SLIP_ENDPOINT` on the Exchange which contains the current endpoint as it advanced though the slip. This allows you to know how far we have processed in the slip. +(It's a slip because the Dynamic Router implementation is based on top of Routing Slip). + +== Samples In Java DSL you can use the `dynamicRouter` as shown below: @@ -60,8 +49,7 @@ from("direct:start") .dynamicRouter(method(DynamicRouterTest.class, "slip")); ---- -Which will leverage a xref:components::bean-component.adoc[Bean] to compute the slip -_on-the-fly_, which could be implemented as follows: +Which will leverage a Bean to compute the slip _on-the-fly_, which could be implemented as follows: [source,java] ---- @@ -74,7 +62,7 @@ _on-the-fly_, which could be implemented as follows: public String slip(String body) { bodies.add(body); invoked++; - + if (invoked == 1) { return "mock:a"; } else if (invoked == 2) { @@ -84,16 +72,13 @@ public String slip(String body) { } else if (invoked == 4) { return "mock:result"; } - + // no more so return null return null; } ---- -Mind that this example is only for show and tell. The current -implementation is not thread safe. You would have to store the state on -the Exchange, to ensure thread safety, as shown -below: +Mind that this example is only for show and tell. The current implementation is not thread safe. You would have to store the state on the Exchange, to ensure thread safety, as shown below: [source,java] ---- @@ -106,7 +91,7 @@ below: */ public String slip(String body, @Properties Map<String, Object> properties) { bodies.add(body); - + // get the state from the exchange properties and keep track how many times // we have been invoked int invoked = 0; @@ -117,7 +102,7 @@ public String slip(String body, @Properties Map<String, Object> properties) { invoked++; // and store the state back on the properties properties.put("invoked", invoked); - + if (invoked == 1) { return "mock:a"; } else if (invoked == 2) { @@ -127,26 +112,21 @@ public String slip(String body, @Properties Map<String, Object> properties) { } else if (invoked == 4) { return "mock:result"; } - + // no more so return null return null; } ---- -You could also store state as message headers, but they are not -guaranteed to be preserved during routing, where as properties on the -Exchange are. Although there was a bug in the method -call expression, see the warning below. - -[[DynamicRouter-SpringXML]] -== Spring XML +You could also store state as message headers, but they are not guaranteed to be preserved during routing, where as properties on the Exchange are. Although there was a bug in the method call expression, see the warning below. +=== Spring XML The same example in Spring XML would be: [source,xml] ---- <bean id="mySlip" class="org.apache.camel.processor.DynamicRouterTest"/> - + <camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="direct:start"/> @@ -155,24 +135,18 @@ The same example in Spring XML would be: <method ref="mySlip" method="slip"/> </dynamicRouter> </route> - + <route> <from uri="direct:foo"/> <transform><constant>Bye World</constant></transform> </route> - + </camelContext> ---- -[[DynamicRouter-DynamicRouterannotation]] == @DynamicRouter annotation - -You can also use the `@DynamicRouter` annotation. The `route` method would -then be invoked repeatedly as the message is processed dynamically. The -idea is to return the next endpoint uri where to go. Return `null` to -indicate the end. You can return multiple endpoints if you like, just as -the Routing Slip, where each endpoint is -separated by a delimiter. +You can also use the `@DynamicRouter` annotation. The `route` method would then be invoked repeatedly as the message is processed dynamically. +The idea is to return the next endpoint uri where to go. Return `null` to indicate the end. You can return multiple endpoints if you like, just as the Routing Slip, where each endpoint is separated by a delimiter. [source,java] ---- @@ -186,16 +160,3 @@ public class MyDynamicRouter { } } ---- - -In the above we can use the -Parameter Binding Annotations -to bind different parts of the Message to method -parameters or use an Expression such as using -xref:components:languages:xpath-language.adoc[XPath] or xref:components:languages:xpath-language.adoc[XQuery]. - -The method can be invoked in a number of ways as described in the -Bean Integration such as - -* POJO Producing -* Spring Remoting -* xref:components::bean-component.adoc[Bean] component 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 98b3279..ea10721 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 @@ -92,7 +92,7 @@ a|image::eip/EventMessageIcon.gif[image] transmit events from one application to another? a|image::eip/RequestReplyIcon.gif[image] -|xref:requestReply-eip.adoc[Request Reply] |When an application sends a +|xref:request-reply.adoc[Request Reply] |When an application sends a message, how can it get a response from the receiver? a|image::eip/ReturnAddressIcon.gif[image] diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/requestReply-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/request-reply.adoc similarity index 88% copy from core/camel-core-engine/src/main/docs/modules/eips/pages/requestReply-eip.adoc copy to core/camel-core-engine/src/main/docs/modules/eips/pages/request-reply.adoc index 191881d..907a9f2 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/requestReply-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/request-reply.adoc @@ -1,6 +1,6 @@ -[[requestReply-eip]] +[[request-reply]] = Request Reply -:page-source: core/camel-core-engine/src/main/docs/eips/requestreply-eip.adoc +:page-source: core/camel-core-engine/src/main/docs/eips/request-reply.adoc Camel supports the http://www.enterpriseintegrationpatterns.com/RequestReply.html[Request @@ -23,12 +23,7 @@ by default perform these actions using the JMSCorrelationID (as you may be performing many concurrent request/responses). -[TIP] -==== -*Related* - -See the related Event Message message -==== +TIP: *Related* See the related Event Message message [[RequestReply-ExplicitlyspecifyingInOut]] == Explicitly specifying InOut @@ -39,7 +34,7 @@ indicated by the presence of the *JMSReplyTo* header. You can explicitly force an endpoint to be in Request Reply mode by setting the exchange pattern on the URI. e.g. -[source] +[source,text] ---- jms:MyQueue?exchangePattern=InOut ---- diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/requestReply-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/requestReply-eip.adoc index 191881d..9a96feb 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/requestReply-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/requestReply-eip.adoc @@ -1,6 +1,5 @@ [[requestReply-eip]] = Request Reply -:page-source: core/camel-core-engine/src/main/docs/eips/requestreply-eip.adoc Camel supports the http://www.enterpriseintegrationpatterns.com/RequestReply.html[Request