Skip to content

Commit 698c947

Browse files
committed
CAMEL-16861: Update docs
1 parent 55dd9f8 commit 698c947

4 files changed

Lines changed: 119 additions & 0 deletions

File tree

core/camel-core-engine/src/main/docs/modules/eips/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
** xref:step-eip.adoc[Step]
9898
** xref:stickyLoadBalancer-eip.adoc[Sticky Load Balancer]
9999
** xref:stop-eip.adoc[Stop]
100+
** xref:throwException-eip.adoc[Stop]
100101
** xref:streamConfig-eip.adoc[StreamConfig]
101102
** xref:threads-eip.adoc[Threads]
102103
** xref:throttle-eip.adoc[Throttle]

core/camel-core-engine/src/main/docs/modules/eips/pages/enterprise-integration-patterns.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ a|image::eip/MessageDispatcherIcon.gif[image]
197197
a|image::eip/MessageExpirationIcon.gif[image]
198198
|xref:stop-eip.adoc[Stop] |How can I stop to continue routing a message?
199199

200+
a|image::eip/MessageExpirationIcon.gif[image]
201+
|xref:throwException-eip.adoc[Throw Exception] |How can I throw an exception during routing?
202+
200203
a|image::eip/MessagingGatewayIcon.gif[image]
201204
|xref:serviceCall-eip.adoc[Service Call] |How can I call a remote service in a distributed system
202205
where the service is looked up from a service registry of some sorts?

core/camel-core-engine/src/main/docs/modules/eips/pages/stop-eip.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,7 @@ using Java code:
104104
Exchange exchange = ...
105105
exchange.setRouteStop(true);
106106
----
107+
108+
== See Also
109+
110+
See also the related xref:throwException-eip.adoc[Throw Exception] EIP.
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
= Stop EIP
2+
:doctitle: Stop
3+
:shortname: stop
4+
:description: Stops the processing of the current message
5+
:since:
6+
:supportlevel: Stable
7+
:tabs-sync-option:
8+
9+
How can I throw an exception
10+
11+
image::eip/MessageExpirationIcon.gif[image]
12+
13+
Use a special processor to throw an exception.
14+
15+
== Options
16+
17+
// eip options: START
18+
include::partial$eip-options.adoc[]
19+
// eip options: END
20+
21+
== Exchange properties
22+
23+
// eip exchangeProperties: START
24+
include::partial$eip-exchangeProperties.adoc[]
25+
// eip exchangeProperties: END
26+
27+
== Using Throw Exception
28+
29+
In a specific situation we want to fail processing the current message by throwing an exception.
30+
In the xref:choice-eip.adoc[Content-Based Router] below we use `throwException` in such a case.
31+
32+
[tabs]
33+
====
34+
Java::
35+
+
36+
[source,java]
37+
----
38+
from("direct:start")
39+
.choice()
40+
.when(simple("${body} contains 'Hello'")).to("mock:hello")
41+
.when(simple("${body} contains 'Bye'")).to("mock:bye").throwException(new IllegalArgumentException("Not allowed"))
42+
.otherwise().to("mock:other")
43+
.end()
44+
.to("mock:result");
45+
----
46+
47+
XML::
48+
+
49+
In XML you specify the FQN class name via `exceptionType` and the `message` is the caused text to include in the exception.
50+
+
51+
[source,xml]
52+
----
53+
<route>
54+
<from uri="direct:start"/>
55+
<choice>
56+
<when>
57+
<simple>${body} contains 'Hello'</simple>
58+
<to uri="mock:hello"/>
59+
</when>
60+
<when>
61+
<simple>${body} contains 'Bye'</simple>
62+
<to uri="mock:bye"/>
63+
<throwException exceptionType="java.lang.IllegalArgumentException" message="Not Allowed"/>
64+
</when>
65+
<otherwise>
66+
<to uri="mock:other"/>
67+
</otherwise>
68+
</choice>
69+
<to uri="mock:result"/>
70+
</route>
71+
----
72+
73+
YAML::
74+
+
75+
In YML you specify the FQN class name via `exceptionType` and the `message` is the caused text to include in the exception.
76+
+
77+
[source,yaml]
78+
----
79+
- route:
80+
from:
81+
uri: direct:start
82+
steps:
83+
- choice:
84+
when:
85+
- expression:
86+
simple:
87+
expression: "${body} contains 'Hello'"
88+
steps:
89+
- to:
90+
uri: mock:hello
91+
- expression:
92+
simple:
93+
expression: "${body} contains 'Bye'"
94+
steps:
95+
- to:
96+
uri: mock:bye
97+
- throwException:
98+
exceptionType: "java.lang.IllegalArgumentException"
99+
message: "Not Allowed"
100+
otherwise:
101+
steps:
102+
- to:
103+
uri: mock:other
104+
- to:
105+
uri: mock:result
106+
----
107+
====
108+
109+
== See Also
110+
111+
See also the related xref:stop-eip.adoc[Stop] EIP.

0 commit comments

Comments
 (0)