Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 299E2200D0D for ; Fri, 25 Aug 2017 10:22:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2841D16C39E; Fri, 25 Aug 2017 08:22:18 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2EF6216C421 for ; Fri, 25 Aug 2017 10:22:16 +0200 (CEST) Received: (qmail 18141 invoked by uid 500); 25 Aug 2017 08:22:15 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 16522 invoked by uid 99); 25 Aug 2017 08:22:13 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Aug 2017 08:22:13 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id CF9FE3A06EC for ; Fri, 25 Aug 2017 08:22:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1017260 [39/40] - in /websites/production/camel/content: ./ cache/ Date: Fri, 25 Aug 2017 08:22:03 -0000 To: commits@camel.apache.org From: buildbot@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170825082208.CF9FE3A06EC@svn01-us-west.apache.org> archived-at: Fri, 25 Aug 2017 08:22:18 -0000 Modified: websites/production/camel/content/wire-tap.html ============================================================================== --- websites/production/camel/content/wire-tap.html (original) +++ websites/production/camel/content/wire-tap.html Fri Aug 25 08:22:01 2017 @@ -36,17 +36,6 @@ - - - - - - - - Apache Camel: Wire Tap @@ -86,112 +75,9 @@ <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">Name</th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</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> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong><span style="color: rgb(255,0,0);">Mandatory</span>:</strong> The URI of the endpoint to which the wire-tapped message should be sent.</p><p>From <strong>Camel 2.16</strong>: support for dynamic <stro ng><code>to</code></strong> URIs is as documented in <a shape="rect" class="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> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Reference ID of a custom <a shape="rect" href="threading-model.html">Thread Pool</a> to use when processing the wire-tapped messages.</p><p>When not set, Camel will use an instance of the 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> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Reference ID of a custom <a shape="rect" href="processor.html">Processor</a> to use for creating a new message.</p><p>See "<strong>Sending a New Exchange</strong>" 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> </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"><p><code>cacheSize</code></p></ td><td colspan="1" rowspan="1" class="confluenceTd"> </td><td colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(0,0,0);"><strong>Camel 2.16:</strong> Allows to configure the cache size for the </span><strong><code>ProducerCache</code></strong><span style="color: rgb(0,0,0);"> which caches producers for reuse. Will by default use the default cache size which is <strong><code>1000</code></strong>. </span></p><p><span style="color: rgb(0,0,0);">Setting the value to <strong><code>-1</code></strong> allows to turn off the cache all together.</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ignoreInvalidEndpoint</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.16:</strong> <span style="color: rgb(0,0,0);">Whether to ignore an endpoint URI that could not be resolved. </span></p><p><span style="color: rgb( 0,0,0);">When <strong><code>false</code></strong>, Camel will throw an exception when it identifies an invalid endpoint URI.</span></p></td></tr></tbody></table></div><h3 id="WireTap-WireTapThreadpool">WireTap Threadpool</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><ul><li>With the traditi onal 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 <strong><code>InOnly</code></strong>, 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 <strong><code>onPrepareRef</code></strong> which does that). So all copies could share objects from the original Exchange.</li><li>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.</li></ul><h4 id="WireTap-SendingaCopy(traditionalwiretap)">Sending a Copy (traditional wiretap)</h4><p><strong>Using the <a shape="rect" hr ef="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("direct:start") - .to("log:foo") - .wireTap("direct:tap") - .to("mock:result"); -]]></script> -</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[ -<route> - <from uri="direct:start"/> - <to uri="log:foo"/> - <wireTap uri="direct:tap"/> - <to uri="mock:result"/> -</route> -]]></script> -</div></div><h4 id="WireTap-SendingaNew">Sending a New <a shape="rect" href="exchange.html">Exchange</a></h4><p><strong>Using the <a shape="rect" href="fluent-builders.html">Fluent Builders</a></strong><br clear="none"> Camel supports either a processor or an <a shape="rect" href="expression.html">Expression</a> to populate the new <a shape="rect" href="exchange.html">Exchange</a>. Using a processor gives you full power over how the <a shape="rect" href="exchange.html">Exchange</a> is populated as you can set properties, headers, etc. An <a shape="rect" href="expression.html">Expression</a> can only be used to set the <strong><code>IN</code></strong> body.</p><p>From <strong>Camel 2.3</strong>: the <a shape="rect" href="expression.html">Expression</a> or <a shape="rect" href="processor.html">Processor</a> is pre-populated with a copy of the original <a shape="rect" href="exchange.html">Exchange</a>, which allows you to access the original message when you prepare a new <a shape ="rect" href="exchange.html">Exchange</a> to be sent. You can use the <strong><code>copy</code></strong> option (enabled by default) to indicate whether you want this. If you set <strong><code>copy=false</code></strong>, then it works as in <strong>Camel 2.2</strong> or older where the <a shape="rect" href="exchange.html">Exchange</a> will be empty.</p><p>Below is the processor variation. This example is from <strong>Camel 2.3</strong>, where we disable <strong><code>copy</code></strong> by passing in <strong><code>false</code></strong> 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"> -<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ -from("direct:start") - .wireTap("direct:foo", false, new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("Bye World"); - exchange.getIn().setHeader("foo", "bar"); - } - }).to("mock:result"); - - -from("direct:foo").to("mock:foo"); -]]></script> -</div></div>Here is the <a shape="rect" href="expression.html">Expression</a> variation. In the following example we disable copying by setting <strong><code>copy</code><code>=false</code></strong> which results in the creation of 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("direct:start") - .wireTap("direct:foo", false, constant("Bye World")) - .to("mock:result"); - -from("direct:foo").to("mock:foo"); -]]></script> -</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><code>processorRef</code></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[ -<route> - <from uri="direct:start2"/> - <wireTap uri="direct:foo" processorRef="myProcessor"/> - <to uri="mock:result"/> -</route> -]]></script> -</div></div>Here is the <a shape="rect" href="expression.html">Expression</a> variation, where the expression is defined in the <strong><code>body</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[ -<route> - <from uri="direct:start"/> - <wireTap uri="direct:foo"> - <body><constant>Bye World</constant></body> - </wireTap> - <to uri="mock:result"/> -</route> -]]></script> -</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>"<strong>Bye ORIGINAL BODY MESSAGE HERE</strong>"</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[ -<route> - <from uri="direct:start"/> - <wireTap uri="direct:foo"> - <body><simple>Bye ${body}</simple></body> - </wireTap> - <to uri="mock:result"/> -</route> -]]></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-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 <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("direct:start") - .wireTap("jms:queue:backup-${header.id}") - .to("bean:doSomething");]]></script> -</div></div><p> </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>. From <strong>Camel 2.8</strong>: it's possible to set headers as well using the DSL.</p><p>The following example sends a new message which has</p><ul class="alternate"><li><strong><code>Bye World</code></strong> as message body.</li><li>A header with key <strong><code>id</code></strong> with the value <strong><code>123</code></strong>.</li><li>A header with key <strong><code>date</code></strong> which has current date as value.</li></ul><h4 id="WireTap-Java DSL">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("direct:start") - // tap a new message and send it to direct:tap - // the new message should be Bye World with 2 headers - .wireTap("direct:tap") - // create the new tap message body and headers - .newExchangeBody(constant("Bye World")) - .newExchangeHeader("id", constant(123)) - .newExchangeHeader("date", simple("${date:now:yyyyMMdd}")) - .end() - // here we continue routing the original messages - .to("mock:result"); - -// this is the tapped route -from("direct:tap") - .to("mock:tap"); -]]></script> -</div></div><h4 id="WireTap-XMLDSL">XML DSL</h4><p>The XML DSL is slightly different than Java DSL in how you configure the message body and headers using <strong><code><body></code></strong> and <strong><code><setHeader></code></strong>:</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[ -<route> - <from uri="direct:start"/> - <!-- tap a new message and send it to direct:tap --> - <!-- the new message should be Bye World with 2 headers --> - <wireTap uri="direct:tap"> - <!-- create the new tap message body and headers --> - <body><constant>Bye World</constant></body> - <setHeader headerName="id"><constant>123</constant></setHeader> - <setHeader headerName="date"><simple>${date:now:yyyyMMdd}</simple></setHeader> - </wireTap> - <!-- here we continue routing the original message --> - <to uri="mock:result"/> -</route> -]]></script> -</div></div><h3 id="WireTap-UsingonPreparetoExecuteCustomLogicwhenPreparingMessages">Using <code>onPrepare</code> to Execute Custom Logic when Preparing Messages</h3><p><strong>Available as of Camel 2.8</strong></p><p>See details at <a shape="rect" href="multicast.html">Multicast</a></p><p></p><h4 id="WireTap-UsingThisPattern">Using This Pattern</h4> - -<p>If you would like to use this EIP Pattern then please read the <a shape="rect" href="getting-started.html">Getting Started</a>, you may also find the <a shape="rect" href="architecture.html">Architecture</a> useful particularly the description of <a shape="rect" href="endpoint.html">Endpoint</a> and <a shape="rect" href="uris.html">URIs</a>. Then you could try out some of the <a shape="rect" href="examples.html">Examples</a> first before trying this pattern out.</p></div> +<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><parameter ac:name="title">Streams</parameter><rich-text-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 deta ils at <a shape="rect" href="stream-caching.html">Stream caching</a>.</p></rich-text-body><h3 id="WireTap-Options">Options</h3><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Name</th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</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> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong><span style="color: rgb(255,0,0);">Mandatory</span>:</strong> The URI of the endpoint to which the wire-tapped message should be sent.</p><p>From <strong>Camel 2.16</strong>: support for dynamic <strong><code>to</code></strong> URIs is as documented in <a shape="rect" class="external-link" href="http://camel.apache.org/message-endpoint.html" style="line-height: 1.4285715;">Message Endp oint.</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> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Reference ID of a custom <a shape="rect" href="threading-model.html">Thread Pool</a> to use when processing the wire-tapped messages.</p><p>When not set, Camel will use an instance of the 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> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Reference ID of a custom <a shape="rect" href="processor.html">Processor</a> to use for creating a new message.</p><p>See "<strong>Sending a New Exchange</strong>" 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> </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"><p><code>cacheSize</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"> </td><td colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(0,0,0);"><strong>Camel 2.16:</strong> Allows to c onfigure the cache size for the </span><strong><code>ProducerCache</code></strong><span style="color: rgb(0,0,0);"> which caches producers for reuse. Will by default use the default cache size which is <strong><code>1000</code></strong>. </span></p><p><span style="color: rgb(0,0,0);">Setting the value to <strong><code>-1</code></strong> allows to turn off the cache all together.</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ignoreInvalidEndpoint</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.16:</strong> <span style="color: rgb(0,0,0);">Whether to ignore an endpoint URI that could not be resolved. </span></p><p><span style="color: rgb(0,0,0);">When <strong><code>false</code></strong>, Camel will throw an exception when it identifies an invalid endpoint URI.</span></p></td></tr></tbody></table></div><h3 id="WireTap-WireT apThreadpool">WireTap Threadpool</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><ul><li>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 <strong><code >InOnly</code></strong>, 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 <strong><code>onPrepareRef</code></strong> which does that). So all copies could share objects from the original Exchange.</li><li>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.</li></ul><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><plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java}</plain -text-body><strong>Using the <a shape="rect" href="spring-xml-extensions.html">Spring XML Extensions</a></strong><plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringWireTapTest.xml}</plain-text-body></p><h4 id="WireTap-SendingaNew">Sending a New <a shape="rect" href="exchange.html">Exchange</a></h4><p><strong>Using the <a shape="rect" href="fluent-builders.html">Fluent Builders</a></strong><br clear="none"> Camel supports either a processor or an <a shape="rect" href="expression.html">Expression</a> to populate the new <a shape="rect" href="exchange.html">Exchange</a>. Using a processor gives you full power over how the <a shape="rect" href="exchange.html">Exchange</a> is populated as you can set properties, headers, etc. An <a shape="rect" href="expression.html">Expression</a> can only be used to set the <strong><code>IN</code></strong> body.</p><p>From <strong>Camel 2.3</strong>: the <a sh ape="rect" href="expression.html">Expression</a> or <a shape="rect" href="processor.html">Processor</a> is pre-populated with a copy of the original <a shape="rect" href="exchange.html">Exchange</a>, which allows you to access the original message when you prepare a new <a shape="rect" href="exchange.html">Exchange</a> to be sent. You can use the <strong><code>copy</code></strong> option (enabled by default) to indicate whether you want this. If you set <strong><code>copy=false</code></strong>, then it works as in <strong>Camel 2.2</strong> or older where the <a shape="rect" href="exchange.html">Exchange</a> will be empty.</p><p>Below is the processor variation. This example is from <strong>Camel 2.3</strong>, where we disable <strong><code>copy</code></strong> by passing in <strong><code>false</code></strong> to create a new, empty <a shape="rect" href="exchange.html">Exchange</a>.<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/pr ocessor/WireTapUsingFireAndForgetTest.java}</plain-text-body>Here is the <a shape="rect" href="expression.html">Expression</a> variation. In the following example we disable copying by setting <strong><code>copy</code><code>=false</code></strong> which results in the creation of a new, empty <a shape="rect" href="exchange.html">Exchange</a>.<plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WireTapUsingFireAndForgetTest.java}</plain-text-body><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><code>processorRef</code></strong> attribute to refer to a Spring bean by ID:<plain-text-body>{snippet:id=e2|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringWireTapUsingFireAndForgetTest.xml}</plain-text-body>Here is the <a shape="rect" href="expression.html"> Expression</a> variation, where the expression is defined in the <strong><code>body</code></strong> tag:<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringWireTapUsingFireAndForgetTest.xml}</plain-text-body>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>"<strong>Bye ORIGINAL BODY MESSAGE HERE</strong>"</code><plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringWireTapUsingFireAndForgetCopyTest.xml}</plain-text-body></p><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/came l/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 <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><plain-text-body>from("direct:start") + .wireTap("jms:queue:backup-${header.id}") + .to("bean:doSomething");</plain-text-body><p> </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>. From <strong>Camel 2.8</strong>: it's possible to set headers as well using the DSL.</p><p>The following example sends a new message which has</p><ul class="alternate"><li><strong><code>Bye World</code></strong> as message body.</li><li>A header with key <strong><code>id</code></strong> with the value <strong><code>123</code></strong>.</li><li>A header with key <strong><code>date</code></strong> which has current date as val ue.</li></ul><h4 id="WireTap-JavaDSL">Java DSL</h4><p><plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/WireTapNewExchangeTest.java}</plain-text-body></p><h4 id="WireTap-XMLDSL">XML DSL</h4><p>The XML DSL is slightly different than Java DSL in how you configure the message body and headers using <strong><code><body></code></strong> and <strong><code><setHeader></code></strong>:<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringWireTapNewExchangeTest.xml}</plain-text-body></p><h3 id="WireTap-UsingonPreparetoExecuteCustomLogicwhenPreparingMessages">Using <code>onPrepare</code> to Execute Custom Logic when Preparing Messages</h3><p><strong>Available as of Camel 2.8</strong></p><p>See details at <a shape="rect" href="multicast.html">Multicast</a></p><p><parameter ac:name=""><a shape="rect" href="using-this-pattern.html ">Using This Pattern</a></parameter></p></div> </td> <td valign="top"> <div class="navigation">