Stop
How can I stop routing a message?
Use a special filter to mark the message to be stopped.
Options
The Stop eip supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
note | The note for this node. | String | |
description | The description for this node. | String | |
disabled | Whether to disable this EIP from the route during build time. Once an EIP has been disabled then it cannot be enabled later at runtime. | false | Boolean |
Message Body
The message body at each side of the Stop EIP: EIP input is the body it needs, EIP output the body after it, and Steps the body its own steps start with.
| Side | Body | Description |
|---|---|---|
EIP output |
| Stops the routing of the message: the body stays as it was. |
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.
Using Stop
We want to stop routing a message if the message body contains the word Bye. In the Content-Based Router below we use stop in such a case.
- Java
-
from("direct:start") .choice() .when(body().contains("Hello")).to("mock:hello") .when(body().contains("Bye")).to("mock:bye").stop() .otherwise().to("mock:other") .end() .to("mock:result"); - 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> - YAML
-
In YAML you use an empty
stop: {}node as shown:
- route:
from:
uri: direct:start
steps:
- choice:
when:
- simple: "${body} contains 'Hello'"
steps:
- to:
uri: mock:hello
- simple: "${body} contains 'Bye'"
steps:
- to:
uri: mock:bye
- stop: {}
otherwise:
steps:
- to:
uri: mock:other
- to:
uri: mock:result See Also
See also the related Throw Exception EIP.