camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r1014928 - in /websites/production/camel/content: cache/main.pageCache intercept.html
Date Mon, 03 Jul 2017 18:18:44 GMT
Author: buildbot
Date: Mon Jul  3 18:18:44 2017
New Revision: 1014928

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/intercept.html

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/intercept.html
==============================================================================
--- websites/production/camel/content/intercept.html (original)
+++ websites/production/camel/content/intercept.html Mon Jul  3 18:18:44 2017
@@ -86,68 +86,30 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="Intercept-Intercept">Intercept</h2>
-
-<p>The intercept feature in Camel supports intercepting <a shape="rect" href="exchange.html">Exchange</a>s
while they are <em>on route</em>. <br clear="none">
-We have overhauled the <a shape="rect" href="intercept.html">Intercept</a> in
Camel 2.0 so the following information is based on Camel 2.0.</p>
-
-<p>Camel supports three kinds of interceptors:</p>
-<ul class="alternate"><li><code>intercept</code> that intercepts
each and every processing step while routing an <a shape="rect" href="exchange.html">Exchange</a>
in the route.</li><li><code>interceptFrom</code> that intercepts incoming
<a shape="rect" href="exchange.html">Exchange</a> in the route.</li><li><code>interceptSendToEndpoint</code>
that intercepts when an <a shape="rect" href="exchange.html">Exchange</a> is about
to be sent to the given <a shape="rect" href="endpoint.html">Endpoint</a>.</li></ul>
-
-
-<p>These interceptors supports the following features:</p>
-<ul class="alternate"><li><a shape="rect" href="predicate.html">Predicate</a>
using <code>when</code> to only trigger the interceptor in certain conditions</li><li><code>stop</code>
forces to stop continue routing the <a shape="rect" href="exchange.html">Exchange</a>
and mark it as completed successful. Camel will by default <strong>not stop</strong>.</li><li><code>skip</code>
when used with <code>interceptSendToEndpoint</code> will <strong>skip</strong>
sending the <a shape="rect" href="exchange.html">Exchange</a> to the original
intended endpoint. Camel will by default <strong>not skip</strong>.</li><li><code>interceptFrom</code>
and <code>interceptSendToEndpoint</code> supports endpoint URI matching by: exact
uri, wildcard, regular expression. See advanced section.</li><li>The intercepted
endpoint uri is stored as message header <code>Exchange.INTERCEPTED_ENDPOINT</code>.</li></ul>
-
-
-<div class="confluence-information-macro confluence-information-macro-tip"><span
class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div
class="confluence-information-macro-body">
-<p><code>stop</code> can be used in general, it does not have to be used
with an <a shape="rect" href="intercept.html">Intercept</a> you can use it in
regular routing as well.</p>
-
-<p>You can also instruct Camel to <code>stop</code> continue routing your
message if you set the <code>Exchange.ROUTE_STOP</code> property to <code>"true"</code>
or <code>Boolean.TRUE</code> on the <a shape="rect" href="exchange.html">Exchange</a>.
You can for instance do this from regular Java code in a <a shape="rect" href="pojo.html">POJO</a>
or <a shape="rect" href="processor.html">Processor</a>.  </p></div></div>
-
-<h3 id="Intercept-Intercept.1">Intercept</h3>
-<p><code>Intercept</code> is like a regular interceptor that is applied
on each processing step the <a shape="rect" href="exchange.html">Exchange</a>
undergo while its being routed. You can think of it as a <em>AOP before</em> that
is applied at each DSL keyword you have defined in your route. </p>
-
-<p>The classic Hello World example would be:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-intercept().to(&quot;log:hello&quot;);
-
-from(&quot;jms:queue:order&quot;).to(&quot;bean:validateOrder&quot;).to(&quot;bean:processOrder&quot;);
+<div class="wiki-content maincontent"><h2 id="Intercept-Intercept">Intercept</h2><p>The
intercept feature in Camel supports intercepting <a shape="rect" href="exchange.html">Exchange</a>s
while they are <em>en route</em>.&#160; We have overhauled the <a shape="rect"
href="intercept.html">Intercept</a> in Camel 2.0 so the following information is
based on Camel 2.0.</p><p>Camel supports three kinds of interceptors:</p><ul
class="alternate"><li><strong><code>intercept</code></strong>
that intercepts each and every processing step while routing an <a shape="rect" href="exchange.html">Exchange</a>
in the route.</li><li><strong><code>interceptFrom</code></strong>
that intercepts incoming <a shape="rect" href="exchange.html">Exchange</a> in
the route.</li><li><strong><code>interceptSendToEndpoint</code></strong>
that intercepts when an <a shape="rect" href="exchange.html">Exchange</a> is about
to be sent to the given <a shape="rect" href="endpoint.html">Endpoint</a>.</li></ul><p>These
int
 erceptors supports the following features:</p><ul class="alternate"><li><a
shape="rect" href="predicate.html">Predicate</a> using <code>when</code>
to only trigger the interceptor in certain conditions</li><li><strong><code>stop</code></strong>
forces to stop continue routing the <a shape="rect" href="exchange.html">Exchange</a>
and mark it as completed successful. Camel will by default <strong>not stop</strong>.</li><li><strong><code>skip</code></strong>
when used with <strong><code>interceptSendToEndpoint</code></strong>
will <strong>skip</strong> routing the <a shape="rect" href="exchange.html">Exchange</a>
to the original endpoint. Camel will by default <strong>not skip</strong>.</li><li><strong><code>interceptFrom</code></strong>
and <strong><code>interceptSendToEndpoint</code></strong> supports
endpoint URI matching by: exact URI, wildcard, regular expression. See advanced section.</li><li>The
intercepted endpoint URI is stored as message header <strong><code>Exchange.INTERCEP
 TED_ENDPOINT</code></strong>.</li></ul><div class="confluence-information-macro
confluence-information-macro-tip"><span class="aui-icon aui-icon-small aui-iconfont-approve
confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p><strong><code>stop</code></strong>
can be used in general, it does not have to be used with an <a shape="rect" href="intercept.html">Intercept</a>
you can use it in regular routing as well.</p><p>You can also instruct Camel to
<code>stop</code> continue routing your message if you set the <strong><code>Exchange.ROUTE_STOP</code></strong>
property to <code><strong>true</strong></code> or <strong><code>Boolean.TRUE</code></strong>
on the <a shape="rect" href="exchange.html">Exchange</a>. You can for instance
do this from regular Java code in a <a shape="rect" href="pojo.html">Pojo</a>
or <a shape="rect" href="processor.html">Processor</a>.</p></div></div><h3
id="Intercept-Intercept.1"><code>Intercept</code></h3><p><strong><co
 de>Intercept</code></strong> is like a regular interceptor that is applied
on each processing step the <a shape="rect" href="exchange.html">Exchange</a>
undergo while its being routed. You can think of it as a <em>AOP before</em> that
is applied at each DSL keyword you have defined in your route.</p><p>The classic
Hello World example is:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[intercept()
+  .to(&quot;log:hello&quot;);
+
+from(&quot;jms:queue:order&quot;)
+  .to(&quot;bean:validateOrder&quot;)
+  .to(&quot;bean:processOrder&quot;);
 ]]></script>
-</div></div>
-
-<p>What happens is that the <a shape="rect" href="exchange.html">Exchange</a>
is intercepted before each processing step, that means that it will be intercepted before</p>
-<ul class="alternate"><li><code>.to("bean:validateOrder")</code></li><li><code>.to("bean:processOrder")</code></li></ul>
-
-
-<p>So in this sample we intercept the <a shape="rect" href="exchange.html">Exchange</a>
twice.</p>
-
-<p>The <code>when</code> predicate is also support on the <code>intercept</code>
so we can attach a <a shape="rect" href="predicate.html">Predicate</a> to only
trigger the interception under certain conditions.<br clear="none">
-For instance in the sample below we only intercept if the message body contains the string
word <strong>Hello</strong>:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div><p>What happens is that the <a shape="rect" href="exchange.html">Exchange</a>
is intercepted before each processing step, that means that it will be intercepted before:</p><ul
class="alternate"><li><code>.to("bean:validateOrder")</code></li><li><code>.to("bean:processOrder")</code></li></ul><p>So
in this sample we intercept the <a shape="rect" href="exchange.html">Exchange</a>
twice.</p><p>The <code>when</code> predicate is also support on the
<strong><code>intercept</code></strong> so we can attach a <a shape="rect"
href="predicate.html">Predicate</a> to only trigger the interception under certain
conditions. For instance in the sample below we only intercept if the message body contains
the string word <strong><code>Hello</code></strong>:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 intercept().when(body().contains(&quot;Hello&quot;)).to(&quot;mock:intercepted&quot;);
 
 from(&quot;direct:start&quot;)
     .to(&quot;mock:foo&quot;, &quot;mock:bar&quot;, &quot;mock:result&quot;);
 ]]></script>
-</div></div>
-
-<p>And in the route below we want to stop in certain conditions, when the message contains
the word 'Hello':</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div>And in the route below we want to stop in certain conditions, when
the message contains the word <strong><strong><code>Hello</code></strong></strong>:<div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 intercept().when(body().contains(&quot;Hello&quot;)).to(&quot;mock:intercepted&quot;).stop();
 
 from(&quot;direct:start&quot;)
     .to(&quot;mock:foo&quot;, &quot;mock:bar&quot;, &quot;mock:result&quot;);
 ]]></script>
-</div></div>
-
-<h4 id="Intercept-UsingfromSpringDSL">Using from Spring DSL</h4>
-<p>The same hello world sample in Spring DSL would be:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-&lt;camelContext ...&gt;
+</div></div><h4 id="Intercept-UsingfromSpringDSL">Using from Spring DSL</h4><p>The
same hello world sample in Spring DSL would be:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;camelContext&gt;
     &lt;intercept&gt;
         &lt;to uri=&quot;log:hello&quot;/&gt;
     &lt;/intercept&gt;
@@ -159,10 +121,7 @@ from(&quot;direct:start&quot;)
     &lt;/route&gt;
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>
-
-<p>And the sample for using the <strong>when</strong> predicate would be:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div><p>And the sample for using the&#160;<strong><code>when()</code></strong>
predicate would be:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
     &lt;!-- here we intercept each processing step in the routing and do a detour
@@ -185,10 +144,7 @@ from(&quot;direct:start&quot;)
     &lt;/route&gt;
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>
-
-<p>And the sample for using the <strong>when</strong> and <strong>stop</strong>
would be:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div>And the sample for using the&#160;<strong><code>when()</code></strong>
and&#160;<strong><code>stop()</code></strong> would be:<div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
 <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
     &lt;intercept&gt;
@@ -210,14 +166,7 @@ from(&quot;direct:start&quot;)
     &lt;/route&gt;
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>
-
-
-<h3 id="Intercept-InterceptFrom">InterceptFrom</h3>
-<p><code>InterceptFrom</code> is for intercepting any incoming <a shape="rect"
href="exchange.html">Exchange</a>, in any route (it intercepts all the <code>from</code>
DSLs). This allows you to do some custom behavior for received <a shape="rect" href="exchange.html">Exchange</a>s.
You can provide a specific uri for a given <a shape="rect" href="endpoint.html">Endpoint</a>
then it only applies for that particular route.</p>
-
-<p>So lets start with the logging example. We want to log all the <strong>incoming</strong>
requests so we use <code>interceptFrom</code> to route to the <a shape="rect"
href="log.html">Log</a> component. As <code>proceed</code> is default
then the <a shape="rect" href="exchange.html">Exchange</a> will continue its route,
and thus it will continue to <code>mock:first</code>.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div><h3 id="Intercept-InterceptFrom"><code>InterceptFrom</code></h3><p><strong><code>InterceptFrom</code></strong>
is for intercepting any incoming <a shape="rect" href="exchange.html">Exchange</a>,
in any route (it intercepts all the <code>from</code> DSLs). This allows you to
do some custom behavior for received <a shape="rect" href="exchange.html">Exchange</a>s.
You can provide a specific URI for a given <a shape="rect" href="endpoint.html">Endpoint</a>
then it only applies for that particular route.</p><p>So lets start with the logging
example. We want to log all the <strong>incoming</strong> requests so we use <strong><code>interceptFrom</code></strong>
to route to the <a shape="rect" href="log.html">Log</a> component. As <code>proceed</code>
is default then the <a shape="rect" href="exchange.html">Exchange</a> will continue
its route, and thus it will continue to <strong><code>mock:first</code></strong>.</p><div
class="code panel pdl" style="border-width: 1px;"><div cl
 ass="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 // intercept all incomming routes and log it
 interceptFrom().to(&quot;log:received&quot;);
@@ -227,10 +176,7 @@ from(&quot;direct:start&quot;).to(&quot;
 
 from(&quot;seda:bar&quot;).to(&quot;mock:result&quot;);
 ]]></script>
-</div></div>
-
-<p>You can also attach a <a shape="rect" href="predicate.html">Predicate</a>
to only trigger if certain conditions is meet. For instance in the route below we intercept
when a test message is send to us, so we can do some custom processing before we continue
routing:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div>You can also attach a <a shape="rect" href="predicate.html">Predicate</a>
to only trigger if certain conditions is meet. For instance in the route below we intercept
when a test message is send to us, so we can do some custom processing before we continue
routing:<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 interceptFrom()
     .when(header(&quot;usertype&quot;).isEqualTo(&quot;test&quot;))
@@ -240,10 +186,7 @@ interceptFrom()
 // and here is our route
 from(&quot;direct:start&quot;).to(&quot;seda:bar&quot;).to(&quot;mock:result&quot;);
 ]]></script>
-</div></div>
-
-<p>And if we want to filter out certain messages we can use the <code>stop()</code>
to instruct Camel to stop continue routing the <a shape="rect" href="exchange.html">Exchange</a>:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div>And if we want to filter out certain messages we can use the <strong><code>stop()</code></strong>
to instruct Camel to stop continue routing the <a shape="rect" href="exchange.html">Exchange</a>:<div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 interceptFrom()
     .when(header(&quot;usertype&quot;).isEqualTo(&quot;test&quot;))
@@ -254,10 +197,7 @@ interceptFrom()
 // and here is our route
 from(&quot;direct:start&quot;).to(&quot;seda:bar&quot;).to(&quot;mock:result&quot;);
 ]]></script>
-</div></div>
-
-<p>And if want to only apply a specific endpoint, as the <strong>seda:bar</strong>
endpoint in the sample below, we can do it like this:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div>And if want to only apply a specific endpoint, as the <strong><code>seda:bar</code></strong>
endpoint in the sample below, we can do it like this:<div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 // only trigger when incoming from seda:bar endpoint
 interceptFrom(&quot;seda:bar&quot;).to(&quot;mock:bar&quot;);
@@ -269,12 +209,7 @@ from(&quot;seda:bar&quot;).to(&quot;mock
 
 from(&quot;seda:foo&quot;).to(&quot;mock:result&quot;);
 ]]></script>
-</div></div>
-
-
-<h4 id="Intercept-UsingfromSpringDSL.1">Using from Spring DSL</h4>
-<p>Intercept is of course also available using Spring DSL as shown in the sample below:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div><h4 id="Intercept-UsingfromSpringDSL.1">Using from Spring DSL</h4><p>Intercept
is of course also available using Spring DSL as shown in the sample below:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
 <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
     &lt;!-- intercept incoming messages and route them to the mock:middle1 endpoint
@@ -291,19 +226,7 @@ from(&quot;seda:foo&quot;).to(&quot;mock
     &lt;/route&gt;
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>
-
-<div class="confluence-information-macro confluence-information-macro-tip"><span
class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div
class="confluence-information-macro-body">
-<p><strong>Notice:</strong> <code>stop</code> is also supported
in <code>interceptFrom</code> so you can intercept from certain endpoints and
route then elsewhere and <code>stop</code> to not continue routing in the original
intended route path.</p></div></div>
-
-<p><span class="confluence-anchor-link" id="Intercept-InterceptSendToEndpoint"></span></p>
-<h3 id="Intercept-InterceptSendToEndpoint">InterceptSendToEndpoint</h3>
-<p><strong>Available as of Camel 2.0</strong></p>
-
-<p>Intercept send to endpoint is triggered when an <a shape="rect" href="exchange.html">Exchange</a>
is being sent to the intercepted endpoint. This allows you to route the <a shape="rect"
href="exchange.html">Exchange</a> to a <a shape="rect" href="detour.html">Detour</a>
or do some custom processing before the <a shape="rect" href="exchange.html">Exchange</a>
is sent to the original intended destination. You can also skip sending to the intended destination.
By default Camel will send to the original intended destination after the intercepted route
completes. And as the regular intercept you can also define an <code>when</code>
<a shape="rect" href="predicate.html">Predicate</a> so we only intercept if the
<a shape="rect" href="predicate.html">Predicate</a> evaluates to <strong>true</strong>.
This allows you do do a bit of filtering, to only intercept when certain criteria is meet.</p>
-
-<p>Let start with a simple example, where we want to intercept when an <a shape="rect"
href="exchange.html">Exchange</a> is being sent to <code>mock:foo</code>:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div><div class="confluence-information-macro confluence-information-macro-tip"><span
class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p><strong>Note:</strong> <strong><code>stop()</code></strong>
is also supported in <strong><code>interceptFrom()</code></strong>
so you can intercept from certain endpoints and route then elsewhere and&#160;<strong><code>stop()</code></strong>
to not continue routing in the original intended route path.</p></div></div><p><span
class="confluence-anchor-link" id="Intercept-InterceptSendToEndpoint"></span></p><h3
id="Intercept-InterceptSendToEndpoint"><code>InterceptSendToEndpoint</code></h3><p><strong>Available
as of Camel 2.0</strong></p><p>Intercept send to endpoint is triggered when
an <a shape="rect" href="exchange.html">Exchange</a> is being sent to the intercepted
endpoint. This allows you to route the <a shape="rect" href="exchange.html">Exchange<
 /a> to a <a shape="rect" href="detour.html">Detour</a> or do some custom processing
before the <a shape="rect" href="exchange.html">Exchange</a> is sent to the original
intended destination. You can also skip sending to the intended destination. By default Camel
will send to the original intended destination after the intercepted route completes. And
as the regular intercept you can also define an <code>when</code> <a shape="rect"
href="predicate.html">Predicate</a> so we only intercept if the <a shape="rect"
href="predicate.html">Predicate</a> evaluates to <strong><code>true</code></strong>.
This allows you do do a bit of filtering, to only intercept when certain criteria is meet.</p><p>Let
start with a simple example, where we want to intercept when an <a shape="rect" href="exchange.html">Exchange</a>
is being sent to <strong><code>mock:foo</code></strong>:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 // we intercept by endpoint, that means that whenever an exchange is about to be sent to
 // this endpoint, its intercepted and routed with this detour route beforehand
@@ -317,10 +240,7 @@ from(&quot;direct:first&quot;)
     .to(&quot;mock:foo&quot;)
     .to(&quot;mock:result&quot;);
 ]]></script>
-</div></div>
-
-<p>And this time we add the <a shape="rect" href="predicate.html">Predicate</a>
so its only when the message body is <code>Hello World</code> we intercept.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div>And this time we add the <a shape="rect" href="predicate.html">Predicate</a>
so its only when the message body is <strong><code>Hello World</code></strong>
we intercept.<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 // we can also attach a predicate to the endpoint interceptor. So in this example the exchange
is
 // only intercepted if the body is Hello World
@@ -332,10 +252,7 @@ from(&quot;direct:second&quot;)
     .to(&quot;mock:foo&quot;)
     .to(&quot;mock:result&quot;);
 ]]></script>
-</div></div>
-
-<p>And to skip sending to the <code>mock:foo</code> endpoint we use the
*<code>skip()</code> DSL in the route at the end to instruct Camel to skip sending
to the original intended endpoint. </p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div>And to skip sending to the <code>mock:foo</code> endpoint
we use the <strong>*<code>skip()</code></strong> DSL in the route
at the end to instruct Camel to skip sending to the original intended endpoint.<div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 // since we use the skipSendToOriginalEndpoint() we instruct Camel to skip
 // sending the exchange to the original intended destination after the intercept
@@ -351,18 +268,7 @@ from(&quot;direct:third&quot;)
     .to(&quot;mock:foo&quot;)
     .to(&quot;mock:result&quot;);
 ]]></script>
-</div></div>
-
-<div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Conditional
skipping</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div
class="confluence-information-macro-body">
-<p>The combination of <code>skipSendToEndpoint</code> with a <code>when</code>
predicate behaves differently depending on the Camel version:</p>
-<ul><li><strong>Before Camel 2.10:</strong> the skipping is applied
unconditionally whether the <code>when</code> predicate is matched or not, i.e.
the <code>when</code> predicate only determines whether the body of the interception
will execute, but it does not control skipping behaviour</li><li><strong>As
of Camel 2.10:</strong> the skipping only occurs if the <code>when</code>
predicate is matched, leading to more natural logic altogether.</li></ul>
-</div></div>
-
-<h4 id="Intercept-UsingfromSpringDSL.2">Using from Spring DSL</h4>
-<p>Intercept endpoint is of course also available using Spring DSL. </p>
-
-<p>We start with the first example from above in Spring DSL:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div><div class="confluence-information-macro confluence-information-macro-tip"><p
class="title">Conditional skipping</p><span class="aui-icon aui-icon-small aui-iconfont-approve
confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>The
combination of <strong><code>skipSendToEndpoint</code></strong> with
a <code>when</code> predicate behaves differently depending on the Camel version:</p><ul><li><p><strong>Before
Camel 2.10:</strong> the skipping is applied unconditionally whether the&#160;<strong><code>when()</code></strong>
predicate is matched or not, i.e. the&#160;<strong><code>when()</code></strong>
predicate only determines whether the body of the interception will execute, but it does not
control skipping behavior.</p></li><li><strong>From Camel 2.10:</strong>
the skipping only occurs if the&#160;<strong><code>when()</code></strong>
predicate is matched, leading to more natural logic altogether.</li></ul></div></div><h4
id="Interce
 pt-UsingfromSpringDSL.2">Using from Spring DSL</h4><p>Intercept endpoint is
of course also available using Spring DSL. We start with the first example from above in Spring
DSL:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
 
@@ -385,10 +291,7 @@ from(&quot;direct:third&quot;)
     &lt;/route&gt;
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>
-
-<p>And the 2nd. Notice how we can leverage the <a shape="rect" href="simple.html">Simple</a>
language for the <a shape="rect" href="predicate.html">Predicate</a>:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div>And the second. Notice how we can leverage the <a shape="rect"
href="simple.html">Simple</a> language for the <a shape="rect" href="predicate.html">Predicate</a>:<div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
 <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
 
@@ -408,10 +311,7 @@ from(&quot;direct:third&quot;)
     &lt;/route&gt;
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>
-
-<p>And the 3rd with the <code>skip</code>, notice skip is set with the
<code>skipSendToOriginalEndpoint</code> attribute on the <strong>interceptSendToEndpoint</strong>
tag:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+</div></div>And the third with the <strong><code>skip</code></strong>;
notice skip is set with the <strong><code>skipSendToOriginalEndpoint</code></strong>
attribute on the&#160;<strong><code>interceptSendToEndpoint</code></strong>
tag:<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
 
@@ -435,46 +335,19 @@ from(&quot;direct:third&quot;)
     &lt;/route&gt;
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>
-
-
-<h3 id="Intercept-AdvancedusageofIntercpt">Advanced usage of Intercpt</h3>
-<p>The <code>interceptFrom</code> and <code>interceptSendToEndpoint</code>
supports endpoint URI matching by the following rules in the given order:</p>
-<ul class="alternate"><li>match by exact URI name. This is the sample we have
seen above.</li><li>match by wildcard</li><li>match by regular expression.</li></ul>
-
-
-<p>The real endpoint that was intercepted is stored as uri in the message IN header
with the key <code>Exchange.INTERCEPTED_ENDPOINT</code>.<br clear="none">
-This allows you to get hold of this information, when you for instance match by wildcard.
Then you know the real endpoint that was intercepted and can react accordingly.</p>
-
-<h4 id="Intercept-Matchbywildcard">Match by wildcard</h4>
-<p>Match by wildcard allows you to match a range of endpoint or all of a given type.
For instance use <code>uri="file:*"</code> will match all <a shape="rect" href="file2.html">File</a>
based endpoints.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-intercept(&quot;jms:*&quot;).to(&quot;log:fromjms&quot;);
+</div></div><h3 id="Intercept-AdvancedusageofIntercept">Advanced usage
of&#160;<code>Intercept</code></h3><p>The <strong><code>interceptFrom</code></strong>
and <strong><code>interceptSendToEndpoint</code></strong> supports
endpoint URI matching by the following rules in the given order:</p><ul class="alternate"><li>match
by exact URI name. This is the sample we have seen above.</li><li>match by wildcard</li><li>match
by regular expression.</li></ul><p>The real endpoint that was intercepted
is stored as URI in the message IN header with the key <strong><code>Exchange.INTERCEPTED_ENDPOINT</code></strong>.
This allows you to get hold of this information, when you for instance match by wildcard.
Then you know the real endpoint that was intercepted and can react accordingly.</p><h4
id="Intercept-MatchbyWildcard">Match by Wildcard</h4><p>Match by wildcard allows
you to match a range of endpoint or all of a given type. For instance use <strong><code>uri="file:*"</code></strong>
will match
  all <a shape="rect" href="file2.html">File</a> based endpoints:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[intercept(&quot;jms:*&quot;)
+  .to(&quot;log:fromjms&quot;);
+]]></script>
+</div></div><p>Wildcards is match that the text before the&#160;<strong><code>*</code></strong>
is matched against the given endpoint and if it also starts with the same characters its a
match. For instance you can do:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[intercept(&quot;file://order/inbox/*&quot;)
+  .to(&quot;log:newfileorders&quot;);
+]]></script>
+</div></div><p>To intercept any files received from the <strong><code>order/inbox</code></strong>
folder.</p><h4 id="Intercept-MatchbyRegularExpression">Match by Regular Expression</h4><p>Match
by regular expression is just like match by wildcard but using regex instead. So if we want
to intercept incoming messages from gold and silver JMS queues we can do:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[intercept(&quot;jms:queue:(gold|silver)&quot;)
+  .to(&quot;seda:handleFast&quot;);
 ]]></script>
-</div></div>
-<p>Wildcards is match that the text before the * is matched against the given endpoint
and if it also starts with the same characters its a match. For instance you can do:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-intercept(&quot;file://order/inbox/*&quot;).to(&quot;log:newfileorders&quot;);
-]]></script>
-</div></div>
-<p>To intercept any files received from the <code>order/inbox</code> folder.</p>
-
-<h4 id="Intercept-Matchbyregularexpression">Match by regular expression</h4>
-<p>Match by regular expression is just like match by wildcard but using regex instead.
So if we want to intercept incoming messages from gold and silver JMS queues we can do:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-intercept(&quot;jms:queue:(gold|silver)&quot;).to(&quot;seda:handleFast&quot;);
-]]></script>
-</div></div>
-
-<div class="confluence-information-macro confluence-information-macro-information"><p
class="title">About dynamic and static behavior of interceptFrom and interceptSendToEndpoint</p><span
class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body">
-<p>The <code>interceptSendToEndpoint</code> is dynamic hence it will also
trigger if a dynamic URI is constructed that Camel was not aware of at startup time.<br
clear="none">
-The <code>interceptFrom</code> is not dynamic as it only intercepts input to
routes registered as routes in <code>CamelContext</code>. So if you dynamic construct
a <code>Consumer</code> using the Camel API and consumes an <a shape="rect"
href="endpoint.html">Endpoint</a> then the <code>interceptFrom</code>
is not triggered.</p></div></div>
-
-<h3 id="Intercept-SeeAlso">See Also</h3>
-<ul class="alternate"><li><a shape="rect" href="architecture.html">Architecture</a></li><li><a
shape="rect" href="aop.html">AOP</a></li></ul></div>
+</div></div><div class="confluence-information-macro confluence-information-macro-information"><p
class="title">About dynamic and static behavior of interceptFrom and interceptSendToEndpoint</p><span
class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>The <strong><code>interceptSendToEndpoint</code></strong>
is dynamic hence it will also trigger if a dynamic URI is constructed that Camel was not aware
of at startup time.<br clear="none"> The <strong><code>interceptFrom</code></strong>
is not dynamic as it only intercepts input to routes registered as routes in <strong><code>CamelContext</code></strong>.
So if you dynamic construct a <code>Consumer</code> using the Camel API and consumes
an <a shape="rect" href="endpoint.html">Endpoint</a> then the <strong><code>interceptFrom</code></strong>
is not triggered.</p></div></div><h3 id="Intercept-SeeAlso">See Also</h3><ul
class="alternate"><li><a shap
 e="rect" href="architecture.html">Architecture</a></li><li><a shape="rect"
href="aop.html">AOP</a></li></ul></div>
         </td>
         <td valign="top">
           <div class="navigation">



Mime
View raw message