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 e34b4ff CAMEL-16861: Cleanup and update EIP docs e34b4ff is described below commit e34b4ff707ecdeaaa97fee18547bc90057451d87 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Fri Oct 15 10:42:20 2021 +0200 CAMEL-16861: Cleanup and update EIP docs --- .../pages/enterprise-integration-patterns.adoc | 3 ++ .../src/main/docs/modules/eips/pages/stop-eip.adoc | 45 +++++++++++++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) 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 b39340b..4143e71 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 @@ -187,6 +187,9 @@ number of endpoints? a|image::eip/MessageDispatcherIcon.gif[image] |xref:circuitBreaker-eip.adoc[Circuit Breaker] |How can I stop to call an external service if the service is broken? +a|image::eip/MessageExpirationIcon.gif[image] +|xref:stop-eip.adoc[Stop] |How can I stop continue routing a message? + a|image::eip/MessagingGatewayIcon.gif[image] |xref:serviceCall-eip.adoc[Service Call] |How can I call a remote service in a distributed system where the service is looked up from a service registry of some sorts? diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/stop-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/stop-eip.adoc index a0bce61..b991349 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/stop-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/stop-eip.adoc @@ -2,16 +2,25 @@ :doctitle: Stop :shortname: stop :description: Stops the processing of the current message -:since: +:since: :supportlevel: Stable +How can I stop continue routing a message? + +image::eip/MessageExpirationIcon.gif[image] + +Use a special filter to mark the message to be stopped. + == Options // eip options: START include::partial$eip-options.adoc[] // eip options: END -== Examples +== Using Stop + +We want to stop routing a message if the message body contains the word Bye. +In the xref:choice-eip.adoc[Content Based Router] below we use `stop` in such case. [source,java] ---- @@ -23,3 +32,35 @@ from("direct:start") .end() .to("mock:result"); ---- + +And in XML: + +[source,xml] +---- +<route> + <from uri="direct:start"/> + <choice> + <when> + <simple>${body} contains 'Hello'</simple> + <to uri="mock:hello"/> + </when> + <when> + <simple>${body} contains 'Bye'</simple> + <stop/> + </when> + <otherwise> + <to uri="mock:other"/> + </otherwise> + </choice> +</route> +---- + +=== Calling stop from Java + +You can also mark an `Exchange` to stop being routed from Java with the following code: + +[source,java] +---- +Exchange exchange = ... +exchange.setRouteStop(true); +----