Modified: websites/production/camel/content/wire-tap.html
==============================================================================
--- websites/production/camel/content/wire-tap.html (original)
+++ websites/production/camel/content/wire-tap.html Mon Jul 20 20:19:47 2015
@@ -86,14 +86,14 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h3 id="WireTap-WireTap">Wire 
Tap</h3><p><a shape="rect" class="external-link" 
href="http://www.enterpriseintegrationpatterns.com/WireTap.html"; 
rel="nofollow">Wire Tap</a> (from the <a shape="rect" 
href="enterprise-integration-patterns.html">EIP patterns</a>) allows you to 
route messages to a separate location while they are being forwarded to the 
ultimate destination.</p><p><span class="confluence-embedded-file-wrapper"><img 
class="confluence-embedded-image confluence-external-resource" 
src="http://www.enterpriseintegrationpatterns.com/img/WireTap.gif"; 
data-image-src="http://www.enterpriseintegrationpatterns.com/img/WireTap.gif";></span></p><div
 class="confluence-information-macro 
confluence-information-macro-information"><p class="title">Streams</p><span 
class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>If you <a shape="rect" 
href="wire-tap.html">Wire Tap
 </a> a stream message body then you should consider enabling <a shape="rect" 
href="stream-caching.html">Stream caching</a> to ensure the message body can be 
read at each endpoint. See more details at <a shape="rect" 
href="stream-caching.html">Stream caching</a>.</p></div></div><h3 
id="WireTap-Options">Options</h3><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>uri</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>The URI of the endpoint to which the wire-tapped 
message will be sent. You should use either <code>uri</code> or 
<code>ref</code>.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>
 <code>ref</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Reference identifier of the endpoint to which the 
wire-tapped message will be sent. You should use either <code>uri</code> or 
<code>ref</code>.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>executorServiceRef</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Reference identifier of a custom <a shape="rect" 
href="threading-model.html">Thread Pool</a> to use when processing the 
wire-tapped messages. If not set, Camel will use a default thread 
pool.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>processorRef</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Reference identifier of a custom <a shape="rect" 
href="processor.ht
 ml">Processor</a> to use for creating a new message (e.g., the "send a new 
message" mode). See below.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>copy</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.3</strong>: Whether to copy the <a 
shape="rect" href="exchange.html">Exchange</a> before wire-tapping the 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>onPrepareRef</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.8:</strong> Reference identifier of a 
custom <a shape="rect" href="processor.html">Processor</a> to prepare the copy 
of the <a shape="rect" href="exchange.html">Exchange</a> to be wire-tapped. 
This allows you to do any custom logic, such as deep-cloning the message 
payload.</p></td></tr></tbody></tab
 le></div><h3 id="WireTap-WireTapthreadpool">WireTap thread pool</h3><p>The <a 
shape="rect" href="wire-tap.html">Wire Tap</a> uses a thread pool to process 
the tapped messages. This thread pool will by default use the settings detailed 
at <a shape="rect" href="threading-model.html">Threading Model</a>. In 
particular, when the pool is exhausted (with all threads utilized), further 
wiretaps will be executed synchronously by the calling thread. To remedy this, 
you can configure an explicit thread pool on the <a shape="rect" 
href="wire-tap.html">Wire Tap</a> having either a different rejection policy, a 
larger worker queue, or more worker threads.</p><h3 
id="WireTap-WireTapnode">WireTap node</h3><p>Camel's Wire Tap node supports two 
flavors when tapping an <a shape="rect" 
href="exchange.html">Exchange</a>:</p><p>-With the traditional Wire Tap, Camel 
will copy the original <a shape="rect" href="exchange.html">Exchange</a> and 
set its <a shape="rect" href="exchange-pattern.html">Exchange P
 attern</a> to InOnly, as we want the tapped <a shape="rect" 
href="exchange.html">Exchange</a> to be sent in a fire and forget style. The 
tapped <a shape="rect" href="exchange.html">Exchange</a> is then sent in a 
separate thread so it can run in parallel with the original. Beware that only 
the Exchange is copied - Wire Tap won't do a deep clone (unless you specify a 
custom processor via <em>onPrepareRef</em> which does that). So all copies 
could share objects from the original Exchange.</p><p>-Camel also provides an 
option of sending a new <a shape="rect" href="exchange.html">Exchange</a> 
allowing you to populate it with new values.</p><h4 
id="WireTap-Sendingacopy(traditionalwiretap)">Sending a copy (traditional 
wiretap)</h4><p><strong>Using the <a shape="rect" 
href="fluent-builders.html">Fluent Builders</a></strong></p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h3 id="WireTap-WireTap">Wire 
Tap</h3><p><a shape="rect" class="external-link" 
href="http://www.enterpriseintegrationpatterns.com/WireTap.html"; 
rel="nofollow">Wire Tap</a> (from the <a shape="rect" 
href="enterprise-integration-patterns.html">EIP patterns</a>) allows you to 
route messages to a separate location while they are being forwarded to the 
ultimate destination.</p><p><span class="confluence-embedded-file-wrapper"><img 
class="confluence-embedded-image confluence-external-resource" 
src="http://www.enterpriseintegrationpatterns.com/img/WireTap.gif"; 
data-image-src="http://www.enterpriseintegrationpatterns.com/img/WireTap.gif";></span></p><div
 class="confluence-information-macro 
confluence-information-macro-information"><p class="title">Streams</p><span 
class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>If you <a shape="rect" 
href="wire-tap.html">Wire Tap
 </a> a stream message body then you should consider enabling <a shape="rect" 
href="stream-caching.html">Stream caching</a> to ensure the message body can be 
read at each endpoint. See more details at <a shape="rect" 
href="stream-caching.html">Stream caching</a>.</p></div></div><h3 
id="WireTap-Options">Options</h3><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>uri</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Mandatory:</strong> The URI of the endpoint to 
which the wire-tapped message will be sent. From <strong>Camel 2.16</strong> 
onwards support dynamic to uris like documented in <a shape="rect" c
 lass="external-link" href="http://camel.apache.org/message-endpoint.html"; 
style="line-height: 1.4285715;">Message Endpoint</a></p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>executorServiceRef</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Reference identifier of a custom <a shape="rect" 
href="threading-model.html">Thread Pool</a> to use when processing the 
wire-tapped messages. If not set, Camel will use a default thread 
pool.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>processorRef</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Reference identifier of a custom <a shape="rect" 
href="processor.html">Processor</a> to use for creating a new message (e.g., 
the "send a new message" mode). See below.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="conflue
 nceTd"><p><code>copy</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.3</strong>: Whether to copy the <a 
shape="rect" href="exchange.html">Exchange</a> before wire-tapping the 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>onPrepareRef</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.8:</strong> Reference identifier of a 
custom <a shape="rect" href="processor.html">Processor</a> to prepare the copy 
of the <a shape="rect" href="exchange.html">Exchange</a> to be wire-tapped. 
This allows you to do any custom logic, such as deep-cloning the message 
payload.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><code>cacheSize</code></td><td colspan="1" rowspan="1" 
class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class=
 "confluenceTd"><span style="color: rgb(0,0,0);"><strong>Camel 2.16:</strong> 
Allows to configure the cache size for 
the&#160;</span><code>ProducerCache</code><span style="color: 
rgb(0,0,0);">&#160;which caches producers for reuse. Will by default use the 
default cache size which is 1000. Setting the value to -1 allows to turn off 
the cache all together.</span></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><code>ignoreInvalidEndpoint</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><strong>Camel 2.16:</strong> <span 
style="color: rgb(0,0,0);">Whether to ignore an endpoint URI that could not be 
resolved. If disabled, Camel will throw an exception identifying the invalid 
endpoint URI.</span></td></tr></tbody></table></div><h3 
id="WireTap-WireTapthreadpool">WireTap thread pool</h3><p>The <a shape="rect" 
href="wire-tap.html">Wire Tap</a> uses a thread pool to process the tapped 
messages. Th
 is thread pool will by default use the settings detailed at <a shape="rect" 
href="threading-model.html">Threading Model</a>. In particular, when the pool 
is exhausted (with all threads utilized), further wiretaps will be executed 
synchronously by the calling thread. To remedy this, you can configure an 
explicit thread pool on the <a shape="rect" href="wire-tap.html">Wire Tap</a> 
having either a different rejection policy, a larger worker queue, or more 
worker threads.</p><h3 id="WireTap-WireTapnode">WireTap node</h3><p>Camel's 
Wire Tap node supports two flavors when tapping an <a shape="rect" 
href="exchange.html">Exchange</a>:</p><p>-With the traditional Wire Tap, Camel 
will copy the original <a shape="rect" href="exchange.html">Exchange</a> and 
set its <a shape="rect" href="exchange-pattern.html">Exchange Pattern</a> to 
InOnly, as we want the tapped <a shape="rect" href="exchange.html">Exchange</a> 
to be sent in a fire and forget style. The tapped <a shape="rect" 
href="exchange.htm
 l">Exchange</a> is then sent in a separate thread so it can run in parallel 
with the original. Beware that only the Exchange is copied - Wire Tap won't do 
a deep clone (unless you specify a custom processor via <em>onPrepareRef</em> 
which does that). So all copies could share objects from the original 
Exchange.</p><p>-Camel also provides an option of sending a new <a shape="rect" 
href="exchange.html">Exchange</a> allowing you to populate it with new 
values.</p><h4 id="WireTap-Sendingacopy(traditionalwiretap)">Sending a copy 
(traditional wiretap)</h4><p><strong>Using the <a shape="rect" 
href="fluent-builders.html">Fluent Builders</a></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[
 from(&quot;direct:start&quot;)
     .to(&quot;log:foo&quot;)
     .wireTap(&quot;direct:tap&quot;)
     .to(&quot;mock:result&quot;);
 ]]></script>
-</div></div><p><strong>Using the <a shape="rect" 
href="spring-xml-extensions.html">Spring XML Extensions</a></strong></p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div><strong>Using the <a shape="rect" 
href="spring-xml-extensions.html">Spring XML Extensions</a></strong><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;route&gt;
     &lt;from uri=&quot;direct:start&quot;/&gt;
@@ -115,7 +115,7 @@ from(&quot;direct:start&quot;)
 
 from(&quot;direct:foo&quot;).to(&quot;mock:foo&quot;);
 ]]></script>
-</div></div><p>Here is the <a shape="rect" 
href="expression.html">Expression</a> variation. This example is from Camel 
2.3, where we disable <code>copy</code> by passing in <code>false</code> to 
create a new, empty <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>Here is the <a shape="rect" href="expression.html">Expression</a> 
variation. This example is from Camel 2.3, where we disable <code>copy</code> 
by passing in <code>false</code> to create a new, empty <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[
 from(&quot;direct:start&quot;)
     .wireTap(&quot;direct:foo&quot;, false, constant(&quot;Bye World&quot;))
@@ -123,7 +123,7 @@ from(&quot;direct:start&quot;)
 
 from(&quot;direct:foo&quot;).to(&quot;mock:foo&quot;);
 ]]></script>
-</div></div><p><strong>Using the <a shape="rect" 
href="spring-xml-extensions.html">Spring XML Extensions</a></strong><br 
clear="none"> The processor variation, which uses a 
<strong>processorRef</strong> attribute to refer to a Spring bean by 
ID:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><strong>Using the <a shape="rect" 
href="spring-xml-extensions.html">Spring XML Extensions</a></strong><br 
clear="none"> The processor variation, which uses a 
<strong>processorRef</strong> attribute to refer to a Spring bean by ID:<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;route&gt;
     &lt;from uri=&quot;direct:start2&quot;/&gt;
@@ -131,7 +131,7 @@ from(&quot;direct:foo&quot;).to(&quot;mo
     &lt;to uri=&quot;mock:result&quot;/&gt;
 &lt;/route&gt;
 ]]></script>
-</div></div><p>Here is the <a shape="rect" 
href="expression.html">Expression</a> variation, where the expression is 
defined in the <strong>body</strong> tag:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>Here is the <a shape="rect" href="expression.html">Expression</a> 
variation, where the expression is defined in the <strong>body</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;route&gt;
     &lt;from uri=&quot;direct:start&quot;/&gt;
@@ -141,7 +141,7 @@ from(&quot;direct:foo&quot;).to(&quot;mo
     &lt;to uri=&quot;mock:result&quot;/&gt;
 &lt;/route&gt;
 ]]></script>
-</div></div><p>This variation accesses the body of the original message and 
creates a new <a shape="rect" href="exchange.html">Exchange</a> based on the <a 
shape="rect" href="expression.html">Expression</a>. It will create a new 
Exchange and have the body contain <code>"Bye ORIGINAL BODY MESSAGE 
HERE"</code></p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div>This variation accesses the body of the original message and 
creates a new <a shape="rect" href="exchange.html">Exchange</a> based on the <a 
shape="rect" href="expression.html">Expression</a>. It will create a new 
Exchange and have the body contain <code>"Bye ORIGINAL BODY MESSAGE 
HERE"</code><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;route&gt;
     &lt;from uri=&quot;direct:start&quot;/&gt;
@@ -151,7 +151,11 @@ from(&quot;direct:foo&quot;).to(&quot;mo
     &lt;to uri=&quot;mock:result&quot;/&gt;
 &lt;/route&gt;
 ]]></script>
-</div></div><h4 id="WireTap-FurtherExample">Further Example</h4><p>For another 
example of this pattern, refer to the <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java";>wire
 tap test case</a>.</p><h3 id="WireTap-SendinganewandsetheadersinDSL">Sending a 
new <a shape="rect" href="exchange.html">Exchange</a> and set headers in 
DSL</h3><p><strong>Available as of Camel 2.8</strong></p><p>If you send a new 
message using <a shape="rect" href="wire-tap.html">Wire Tap</a>, then you could 
only set the message body using an <a shape="rect" 
href="expression.html">Expression</a> from the DSL. If you also need to set 
headers, you would have to use a <a shape="rect" 
href="processor.html">Processor</a>. In Camel 2.8 onwards, you can now set 
headers as well in the DSL.</p><p>The following example sends a new message 
which has</p><ul class="alternate"><li>"Bye World" as message body</li><li>a hea
 der with key "id" with the value 123</li><li>a header with key "date" which 
has current date as value</li></ul><h4 id="WireTap-JavaDSL">Java DSL</h4><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div><h4 id="WireTap-FurtherExample">Further Example</h4><p>For another 
example of this pattern, refer to the <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java";>wire
 tap test case</a>.</p><h3 id="WireTap-UsingDynamicUris">Using Dynamic 
Uris</h3><p><strong>Available as of Camel 2.16:</strong></p><p>For example to 
wire tap to a dynamic uri, then it supports the same dynamic uris as documented 
in&#160;<a shape="rect" href="message-endpoint.html">Message Endpoint</a>. For 
example to wire tap to a JMS queue where the header ID is part of the queue 
name</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[from(&quot;direct:start&quot;)
+   .wireTap(&quot;jms:queue:backup-${header.id}&quot;)
+   .to(&quot;bean:doSomething&quot;);]]></script>
+</div></div><p>&#160;</p><h3 
id="WireTap-SendinganewandsetheadersinDSL">Sending a new <a shape="rect" 
href="exchange.html">Exchange</a> and set headers in 
DSL</h3><p><strong>Available as of Camel 2.8</strong></p><p>If you send a new 
message using <a shape="rect" href="wire-tap.html">Wire Tap</a>, then you could 
only set the message body using an <a shape="rect" 
href="expression.html">Expression</a> from the DSL. If you also need to set 
headers, you would have to use a <a shape="rect" 
href="processor.html">Processor</a>. In Camel 2.8 onwards, you can now set 
headers as well in the DSL.</p><p>The following example sends a new message 
which has</p><ul class="alternate"><li>"Bye World" as message body</li><li>a 
header with key "id" with the value 123</li><li>a header with key "date" which 
has current date as value</li></ul><h4 id="WireTap-JavaDSL">Java 
DSL</h4><p></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[
 from(&quot;direct:start&quot;)
     // tap a new message and send it to direct:tap


Reply via email to