Author: buildbot Date: Mon Feb 20 17:21:19 2017 New Revision: 1007060 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/book-in-one-page.html websites/production/camel/content/book-pattern-appendix.html websites/production/camel/content/cache/main.pageCache websites/production/camel/content/routing-slip.html Modified: websites/production/camel/content/book-in-one-page.html ============================================================================== --- websites/production/camel/content/book-in-one-page.html (original) +++ websites/production/camel/content/book-in-one-page.html Mon Feb 20 17:21:19 2017 @@ -3933,11 +3933,11 @@ The tutorial has been designed in two pa While not actual tutorials you might find working through the source of the various <a shape="rect" href="examples.html">Examples</a> useful.</li></ul> <h2 id="BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring Remoting with JMS</h2><p> </p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Thanks</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>This tutorial was kindly donated to Apache Camel by Martin Gilday.</p></div></div><h2 id="BookInOnePage-Preface">Preface</h2><p>This tutorial aims to guide the reader through the stages of creating a project which uses Camel to facilitate the routing of messages from a JMS queue to a <a shape="rect" class="external-link" href="http://www.springramework.org" rel="nofollow">Spring</a> service. The route works in a synchronous fashion returning a response to the client.</p><p><style type="text/css">/*<![CDATA[*/ -div.rbtoc1487409607597 {padding: 0px;} -div.rbtoc1487409607597 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1487409607597 li {margin-left: 0px;padding-left: 0px;} +div.rbtoc1487611171052 {padding: 0px;} +div.rbtoc1487611171052 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1487611171052 li {margin-left: 0px;padding-left: 0px;} -/*]]>*/</style></p><div class="toc-macro rbtoc1487409607597"> +/*]]>*/</style></p><div class="toc-macro rbtoc1487611171052"> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring Remoting with JMS</a></li><li><a shape="rect" href="#BookInOnePage-Preface">Preface</a></li><li><a shape="rect" href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a shape="rect" href="#BookInOnePage-Distribution">Distribution</a></li><li><a shape="rect" href="#BookInOnePage-About">About</a></li><li><a shape="rect" href="#BookInOnePage-CreatetheCamelProject">Create the Camel Project</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-UpdatethePOMwithDependencies">Update the POM with Dependencies</a></li></ul> </li><li><a shape="rect" href="#BookInOnePage-WritingtheServer">Writing the Server</a> @@ -6052,11 +6052,11 @@ So we completed the last piece in the pi <p>This example has been removed from <strong>Camel 2.9</strong> onwards. Apache Axis 1.4 is a very old and unsupported framework. We encourage users to use <a shape="rect" href="cxf.html">CXF</a> instead of Axis.</p></div></div> <style type="text/css">/*<![CDATA[*/ -div.rbtoc1487409607881 {padding: 0px;} -div.rbtoc1487409607881 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1487409607881 li {margin-left: 0px;padding-left: 0px;} +div.rbtoc1487611171602 {padding: 0px;} +div.rbtoc1487611171602 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1487611171602 li {margin-left: 0px;padding-left: 0px;} -/*]]>*/</style><div class="toc-macro rbtoc1487409607881"> +/*]]>*/</style><div class="toc-macro rbtoc1487611171602"> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-TutorialusingAxis1.4withApacheCamel">Tutorial using Axis 1.4 with Apache Camel</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a shape="rect" href="#BookInOnePage-Distribution">Distribution</a></li><li><a shape="rect" href="#BookInOnePage-Introduction">Introduction</a></li><li><a shape="rect" href="#BookInOnePage-SettinguptheprojecttorunAxis">Setting up the project to run Axis</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Maven2">Maven 2</a></li><li><a shape="rect" href="#BookInOnePage-wsdl">wsdl</a></li><li><a shape="rect" href="#BookInOnePage-ConfiguringAxis">Configuring Axis</a></li><li><a shape="rect" href="#BookInOnePage-RunningtheExample">Running the Example</a></li></ul> @@ -12750,35 +12750,36 @@ from("direct:start") </div> </div><p>A full example of the static Scatter-Gather configuration can be found in the <a shape="rect" href="loan-broker-example.html">Loan Broker Example</a>.</p><h4 id="BookInOnePage-UsingThisPattern.22">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><h3 id="BookInOnePage-RoutingSlip">Routing Slip</h3><p>The <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/RoutingTable.html" rel="nofollow">Routing Slip</a> from the <a shape="rect" href="enterprise-integration-patterns.html">EIP patterns</a> allows you to route a message consecutively through a series of processing steps where the sequence of steps is not known at design time and can vary for each message.</p><p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image confluence-external-resource" src="http://www.enterpriseintegrationpatterns.com/img/RoutingTableSimple.gif" data-image-src="http://www.enterpriseintegrationpatterns.com/img/RoutingTableSimple.gif"></span></p><h3 id="BookInOnePage-Options.12">Options</h3><div class="confluenceTableSmall"> <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>uriDelimiter</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>,</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Delimiter used if the <a shape="rect" href="expression.html">Expression</a> returned multiple endpoints. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>ignoreInvalidEndpoints</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> If an endpoint uri could not be resolved, should it be ignored. Otherwise Camel will throw an exception stating the endpoint uri is not valid. </p></td></ tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>cacheSize</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>1000</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.13.1/2.12.4:</strong> Allows to configure the cache size for the <code>ProducerCache</code> which caches producers for reuse in the routing slip. Will by default use the default cache size which is 1000. Setting the value to -1 allows to turn off the cache all together. </p></td></tr></tbody></table> + <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>uriDelimiter</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>,</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Delimiter used if the <a shape="rect" href="expression.html">Expression</a> returned multiple endpoints.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ignoreInvalidEndpoints</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>If an endpoint URI could not be resolved, should it be ignored.</p><p>Otherwise, Camel will throw an exception stating the endpoint URI is not valid.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>cacheSize</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.13.1/2.12.4:</strong> Allows to configure the cache size for the <strong><code>ProducerCache</code></strong> which caches producers for reuse in the routing slip.</p><p>The default cache size which is <strong><code>1000</code></strong>.</p><p>A value of <strong><code>-1</code></strong> disables the use of the cache.</p></td></tr></tbody></table> </div> -</div><h4 id="BookInOnePage-Example.9">Example</h4><p>The following route will take any messages sent to the <a shape="rect" class="external-link" href="http://activemq.apache.org">Apache ActiveMQ</a> queue <strong>SomeQueue</strong> and pass them into the <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/RoutingTable.html" rel="nofollow">Routing Slip</a> pattern.</p><div class="code panel pdl" style="border-width: 1px;"> +</div><h4 id="BookInOnePage-Example.9">Example</h4><p>The following route will take any messages sent to the <a shape="rect" class="external-link" href="http://activemq.apache.org">Apache ActiveMQ</a> queue <strong><code>SomeQueue</code></strong> and pass them into the <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/RoutingTable.html" rel="nofollow">Routing Slip</a> pattern.</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">from(&quot;activemq:SomeQueue&quot;).routingSlip(&quot;aRoutingSlipHeader&quot;); </script> + <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">from(&quot;activemq:SomeQueue&quot;) .routingSlip(&quot;aRoutingSlipHeader&quot;); </script> </div> -</div><p>Messages will be checked for the existance of the "aRoutingSlipHeader" header. The value of this header should be a comma-delimited list of endpoint <a shape="rect" href="uris.html">URIs</a> you wish the message to be routed to. The <a shape="rect" href="message.html">Message</a> will be routed in a <a shape="rect" href="pipes-and-filters.html">pipeline</a> fashion (i.e. one after the other).</p><p>From Camel 2.5 the <a shape="rect" href="routing-slip.html">Routing Slip</a> will set a property (<code>Exchange.SLIP_ENDPOINT</code>) on the <a shape="rect" href="exchange.html">Exchange</a> which contains the current endpoint as it advanced though the slip. This allows you to <em>know</em> how far we have processed in the slip.</p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> will compute the slip <strong>beforehand</strong> which means, the slip is only computed once. If you need to compute the slip <em>on-the-fly</em> then use the <a shape="rect" href="dyna mic-router.html">Dynamic Router</a> pattern instead.</p><h4 id="BookInOnePage-Configurationoptions">Configuration options</h4><p>Here we set the header name and the URI delimiter to something different.</p><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"> from(&quot;direct:c&quot;).routingSlip(header(&quot;aRoutingSlipHeader&quot;), &quot;#&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><p>Messages will be checked for the existence of the <strong><code>aRoutingSlipHeader</code></strong> header. The value of this header should be a comma-delimited list of endpoint <a shape="rect" href="uris.html">URIs</a> you wish the message to be routed to. The <a shape="rect" href="message.html">Message</a> will be routed in a <a shape="rect" href="pipes-and-filters.html">pipeline</a> fashion, i.e., one after the other. From <strong>Camel 2.5</strong> the <a shape="rect" href="routing-slip.html">Routing Slip</a> will set a property, <strong><code>Exchange.SLIP_ENDPOINT</code>, </strong>on the <a shape="rect" href="exchange.html">Exchange</a> which contains the current endpoint as it advanced though the slip. This allows you to <em>know</em> how far we have processed in the slip.</p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> will compute the slip <strong>beforehand</strong> which means, the slip is only computed once. If you need to compute the sli p <em>on-the-fly</em> then use the <a shape="rect" href="dynamic-router.html">Dynamic Router</a> pattern instead.</p><h4 id="BookInOnePage-ConfigurationOptions">Configuration Options</h4><p>Here we set the header name and the URI delimiter to something different.</p><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"> from(&quot;direct:c&quot;).routingSlip(header(&quot;aRoutingSlipHeader&quot;), &quot;#&quot;); </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: java; gutter: false; theme: Default" type="syntaxhighlighter">&lt;camelContext id=&quot;buildRoutingSlip&quot; xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot;&gt; &lt;route&gt; &lt;from uri=&quot;direct:c&quot;/&gt; &lt;routingSlip uriDelimiter=&quot;#&quot;&gt; &lt;header&gt;aRoutingSlipHeader&lt;/header&gt; &lt;/routingSlip&gt; &lt;/route&gt; &lt;/camelContext&gt; </script> </div> -</div><h3 id="BookInOnePage-Ignoreinvalidendpoints.1">Ignore invalid endpoints</h3><p><strong>Available as of Camel 2.3</strong></p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> now supports <code>ignoreInvalidEndpoints</code> which the <a shape="rect" href="recipient-list.html">Recipient List</a> also supports. You can use it to skip endpoints which are invalid.</p><div class="code panel pdl" style="border-width: 1px;"> +</div><h3 id="BookInOnePage-IgnoreInvalidEndpoints">Ignore Invalid Endpoints</h3><p><strong>Available as of Camel 2.3</strong></p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> now supports <strong><code>ignoreInvalidEndpoints</code></strong> which the <a shape="rect" href="recipient-list.html">Recipient List</a> also supports. You can use it to skip endpoints which are invalid.</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"> from(&quot;direct:a&quot;).routingSlip(&quot;myHeader&quot;).ignoreInvalidEndpoints(); </script> + <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">from(&quot;direct:a&quot;) .routingSlip(&quot;myHeader&quot;) .ignoreInvalidEndpoints(); </script> </div> -</div><p>And in Spring XML its an attribute on the recipient list tag.</p><div class="code panel pdl" style="border-width: 1px;"> +</div><p>And in Spring XML its an attribute on the recipient list tag:</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"> &lt;route&gt; &lt;from uri=&quot;direct:a&quot;/&gt; &lt;routingSlip ignoreInvalidEndpoints=&quot;true&quot;/&gt; &lt;header&gt;myHeader&lt;/header&gt; &lt;/routingSlip&gt; &lt;/route&gt; </script> + <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;route&gt; &lt;from uri=&quot;direct:a&quot;/&gt; &lt;routingSlip ignoreInvalidEndpoints=&quot;true&quot;/&gt; &lt;header&gt;myHeader&lt;/header&gt; &lt;/routingSlip&gt; &lt;/route&gt; </script> </div> -</div><p>Then lets say the <code>myHeader</code> contains the following two endpoints <code>direct:foo,xxx:bar</code>. The first endpoint is valid and works. However the 2nd is invalid and will just be ignored. Camel logs at INFO level, so you can see why the endpoint was invalid.</p><h3 id="BookInOnePage-Expressionsupporting">Expression supporting</h3><p><strong>Available as of Camel 2.4</strong></p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> now supports to take the expression parameter as the <a shape="rect" href="recipient-list.html">Recipient List</a> does. You can tell Camel the expression that you want to use to get the routing slip.</p><div class="code panel pdl" style="border-width: 1px;"> +</div><p>Then let's say the <strong><code>myHeader</code></strong> contains the following two endpoints <strong><code>direct:foo,xxx:bar</code></strong>. The first endpoint is valid and works. However the second endpoint is invalid and will just be ignored. Camel logs at <strong><code>INFO</code></strong> level, so you can see why the endpoint was invalid.</p><h3 id="BookInOnePage-ExpressionSupport">Expression Support</h3><p><strong>Available as of Camel 2.4</strong></p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> now supports to take the expression parameter as the <a shape="rect" href="recipient-list.html">Recipient List</a> does. You can tell Camel the expression that you want to use to get the routing slip.</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"> from(&quot;direct:a&quot;).routingSlip(header(&quot;myHeader&quot;)).ignoreInvalidEndpoints(); </script> + <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">from(&quot;direct:a&quot;) .routingSlip(header(&quot;myHeader&quot;)) .ignoreInvalidEndpoints(); </script> </div> </div><p>And in Spring XML its an attribute on the recipient list tag.</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"> &lt;route&gt; &lt;from uri=&quot;direct:a&quot;/&gt; &lt;!--NOTE from Camel 2.4.0, you need to specify the expression element inside of the routingSlip element --&gt; &lt;routingSlip ignoreInvalidEndpoints=&quot;true&quot;&gt; &lt;header&gt;myHeader&lt;/header&gt; &lt;/routingSlip&gt; &lt;/route&gt; </script> + <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;route&gt; &lt;from uri=&quot;direct:a&quot;/&gt; &lt;!--NOTE from Camel 2.4.0, you need to specify the expression element inside of the routingSlip element --&gt; &lt;routingSlip ignoreInvalidEndpoints=&quot;true&quot;&gt; &lt;header&gt;myHeader&lt;/header&gt; &lt;/routingSlip&gt; &lt;/route&gt; </script> </div> </div><h4 id="BookInOnePage-FurtherExamples.1">Further Examples</h4><p>For further examples of this pattern in use you could look at the <a shape="rect" class="external-link" href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/routingslip">routing slip test cases</a>.</p><p></p><h4 id="BookInOnePage-UsingThisPattern.23">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><h3 id="BookInOnePage-Throttler">Throttler</h3><p>The Throttler Pattern allows you to ensure that a specific endpoint does not get overloaded, or that we don't exceed an agreed SLA with some external service.</p><h3 id="BookInOnePage-Options.13">Options</h3><div class="confluenceTableSmall"> <div class="table-wrap"> @@ -14244,8 +14245,8 @@ cometds://localhost:8443/service/mychann <div class="confluence-information-macro-body"> <p>When using CXF in streaming modes (see DataFormat option), then also read about <a shape="rect" href="stream-caching.html">Stream caching</a>.</p> </div> -</div><p>The <strong>cxf:</strong> component provides integration with <a shape="rect" href="http://cxf.apache.org">Apache CXF</a> for connecting to JAX-WS services hosted in CXF.</p><p><style type="text/css">/**/ div.rbtoc1487409612038 {padding: 0px;} div.rbtoc1487409612038 ul {list-style: disc;margin-left: 0px;} div.rbtoc1487409612038 li {margin-left: 0px;padding-left: 0px;} /**/</style> - </p><div class="toc-macro rbtoc1487409612038"> +</div><p>The <strong>cxf:</strong> component provides integration with <a shape="rect" href="http://cxf.apache.org">Apache CXF</a> for connecting to JAX-WS services hosted in CXF.</p><p><style type="text/css">/**/ div.rbtoc1487611182662 {padding: 0px;} div.rbtoc1487611182662 ul {list-style: disc;margin-left: 0px;} div.rbtoc1487611182662 li {margin-left: 0px;padding-left: 0px;} /**/</style> + </p><div class="toc-macro rbtoc1487611182662"> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-CXFComponent">CXF Component</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-URIformat">URI format</a></li><li><a shape="rect" href="#BookInOnePage-Options">Options</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Thedescriptionsofthedataformats">The descriptions of the dataformats</a> @@ -16714,7 +16715,7 @@ cometds://localhost:8443/service/mychann <p>If you intend to use <a shape="rect" class="external-link" href="http://activemq.apache.org/">Apache ActiveMQ</a> as your Message Broker - which is a good choice as ActiveMQ rocks <img class="emoticon emoticon-smile" src="https://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/smile.png" data-emoticon-name="smile" alt="(smile)"> , then we recommend that you either:</p> <ul><li><p>Use the <a shape="rect" href="activemq.html">ActiveMQ</a> component, which is already optimized to use ActiveMQ efficiently</p></li><li><p>Use the <strong><code>PoolingConnectionFactory</code></strong> in ActiveMQ</p></li></ul> </div> -</div><h4 id="BookInOnePage-TransactionsandCacheLevels">Transactions and Cache Levels</h4><p><span class="confluence-anchor-link" id="BookInOnePage-transactionCacheLevels"></span><br clear="none"> If you are consuming messages and using transactions (<strong><code>transacted=true</code></strong>) then the default cache level can negatively impact performance. If you are using XA transactions then you cannot cache as it can cause the XA transaction to not work properly.</p><p>If you are <em>not</em> using XA, then you should consider caching as it speeds up performance, such as setting <strong><code>cacheLevelName=CACHE_CONSUMER</code></strong>. Through Camel 2.7.x, the default setting for <strong><code>cacheLevelName</code></strong> is <strong><code>CACHE_CONSUMER</code></strong>. You will need to explicitly set <strong><code>cacheLevelName=CACHE_NONE</code></strong>. In Camel 2.8 onward, the default setting for <strong><code>cacheLevelName</code></strong> is <strong><code>CACHE_AUT O</code></strong>. This default auto detects the mode and sets the cache level accordingly to:</p><ul class="alternate"><li><p><strong><code>CACHE_CONSUMER</code></strong> when <strong><code>transacted=false</code></strong></p></li><li><p><strong><code>CACHE_NONE</code></strong> when <strong><code>transacted=true</code></strong></p></li></ul><p>So you can say the default setting is conservative. Consider using <strong><code>cacheLevelName=CACHE_CONSUMER</code></strong> if you are using non-XA transactions.</p><h4 id="BookInOnePage-DurableSubscriptions">Durable Subscriptions</h4><p>If you wish to use durable topic subscriptions, you need to specify both <strong><code>clientId</code></strong>  and <strong><code>durableSubscriptionName</code>. </strong>The value of the<strong> <code>clientId</code></strong> must be unique and can only be used by a single JMS connection instance in your entire network. You may prefer to use <a shape="rect" class="external-link" href= "http://activemq.apache.org/virtual-destinations.html">Virtual Topics</a> instead to avoid this limitation. More background on durable messaging <a shape="rect" class="external-link" href="http://activemq.apache.org/how-do-durable-queues-and-topics-work.html">here</a>.</p><h4 id="BookInOnePage-MessageHeaderMapping">Message Header Mapping</h4><p>When using message headers, the JMS specification states that header names must be valid Java identifiers. So try to name your headers to be valid Java identifiers. One benefit of doing this is that you can then use your headers inside a JMS Selector (whose SQL92 syntax mandates Java identifier syntax for headers).</p><p>A simple strategy for mapping header names is used by default. The strategy is to replace any dots and hyphens in the header name as shown below and to reverse the replacement when the header name is restored from a JMS message sent over the wire. What does this mean? No more losing method names to invoke on a bean component, no more losing the filename header for the File Component, and so on.</p><p>The current header name strategy for accepting header names in Camel is:</p><ul class="alternate"><li><p>Dots are replaced by <strong><code>_DOT_</code></strong> and the replacement is reversed when Camel consume the message</p></li><li><p>Hyphen is replaced by <strong><code>_HYPHEN_</code></strong> and the replacement is reversed when Camel consumes the message</p></li></ul><h3 id="BookInOnePage-ConfigurationOptions">Configuration Options</h3><p>You can configure many different properties on the JMS endpoint which map to properties on the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-jms/apidocs/org/apache/camel/component/jms/JmsConfiguration.html">JMSConfiguration POJO</a>.</p><div class="confluence-information-macro confluence-information-macro-note"> +</div><h4 id="BookInOnePage-TransactionsandCacheLevels">Transactions and Cache Levels</h4><p><span class="confluence-anchor-link" id="BookInOnePage-transactionCacheLevels"></span><br clear="none"> If you are consuming messages and using transactions (<strong><code>transacted=true</code></strong>) then the default cache level can negatively impact performance. If you are using XA transactions then you cannot cache as it can cause the XA transaction to not work properly.</p><p>If you are <em>not</em> using XA, then you should consider caching as it speeds up performance, such as setting <strong><code>cacheLevelName=CACHE_CONSUMER</code></strong>. Through Camel 2.7.x, the default setting for <strong><code>cacheLevelName</code></strong> is <strong><code>CACHE_CONSUMER</code></strong>. You will need to explicitly set <strong><code>cacheLevelName=CACHE_NONE</code></strong>. In Camel 2.8 onward, the default setting for <strong><code>cacheLevelName</code></strong> is <strong><code>CACHE_AUT O</code></strong>. This default auto detects the mode and sets the cache level accordingly to:</p><ul class="alternate"><li><p><strong><code>CACHE_CONSUMER</code></strong> when <strong><code>transacted=false</code></strong></p></li><li><p><strong><code>CACHE_NONE</code></strong> when <strong><code>transacted=true</code></strong></p></li></ul><p>So you can say the default setting is conservative. Consider using <strong><code>cacheLevelName=CACHE_CONSUMER</code></strong> if you are using non-XA transactions.</p><h4 id="BookInOnePage-DurableSubscriptions">Durable Subscriptions</h4><p>If you wish to use durable topic subscriptions, you need to specify both <strong><code>clientId</code></strong>  and <strong><code>durableSubscriptionName</code>. </strong>The value of the<strong> <code>clientId</code></strong> must be unique and can only be used by a single JMS connection instance in your entire network. You may prefer to use <a shape="rect" class="external-link" href= "http://activemq.apache.org/virtual-destinations.html">Virtual Topics</a> instead to avoid this limitation. More background on durable messaging <a shape="rect" class="external-link" href="http://activemq.apache.org/how-do-durable-queues-and-topics-work.html">here</a>.</p><h4 id="BookInOnePage-MessageHeaderMapping">Message Header Mapping</h4><p>When using message headers, the JMS specification states that header names must be valid Java identifiers. So try to name your headers to be valid Java identifiers. One benefit of doing this is that you can then use your headers inside a JMS Selector (whose SQL92 syntax mandates Java identifier syntax for headers).</p><p>A simple strategy for mapping header names is used by default. The strategy is to replace any dots and hyphens in the header name as shown below and to reverse the replacement when the header name is restored from a JMS message sent over the wire. What does this mean? No more losing method names to invoke on a bean component, no more losing the filename header for the File Component, and so on.</p><p>The current header name strategy for accepting header names in Camel is:</p><ul class="alternate"><li><p>Dots are replaced by <strong><code>_DOT_</code></strong> and the replacement is reversed when Camel consume the message</p></li><li><p>Hyphen is replaced by <strong><code>_HYPHEN_</code></strong> and the replacement is reversed when Camel consumes the message</p></li></ul><h3 id="BookInOnePage-ConfigurationOptions.1">Configuration Options</h3><p>You can configure many different properties on the JMS endpoint which map to properties on the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-jms/apidocs/org/apache/camel/component/jms/JmsConfiguration.html">JMSConfiguration POJO</a>.</p><div class="confluence-information-macro confluence-information-macro-note"> <p class="title">Mapping to Spring JMS</p> <span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span> <div class="confluence-information-macro-body"> Modified: websites/production/camel/content/book-pattern-appendix.html ============================================================================== --- websites/production/camel/content/book-pattern-appendix.html (original) +++ websites/production/camel/content/book-pattern-appendix.html Mon Feb 20 17:21:19 2017 @@ -1128,35 +1128,36 @@ </div> </div><p>A full example of the static Scatter-Gather configuration can be found in the <a shape="rect" href="loan-broker-example.html">Loan Broker Example</a>.</p><h4 id="BookPatternAppendix-UsingThisPattern.22">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><h3 id="BookPatternAppendix-RoutingSlip">Routing Slip</h3><p>The <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/RoutingTable.html" rel="nofollow">Routing Slip</a> from the <a shape="rect" href="enterprise-integration-patterns.html">EIP patterns</a > allows you to route a message consecutively through a series of processing > steps where the sequence of steps is not known at design time and can vary > for each message.</p><p><span class="confluence-embedded-file-wrapper"><img > class="confluence-embedded-image confluence-external-resource" > src="http://www.enterpriseintegrationpatterns.com/img/RoutingTableSimple.gif" > > data-image-src="http://www.enterpriseintegrationpatterns.com/img/RoutingTableSimple.gif"></span></p><h3 > id="BookPatternAppendix-Options.3">Options</h3><div > class="confluenceTableSmall"> <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>uriDelimiter</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>,</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Delimiter used if the <a shape="rect" href="expression.html">Expression</a> returned multiple endpoints. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>ignoreInvalidEndpoints</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> If an endpoint uri could not be resolved, should it be ignored. Otherwise Camel will throw an exception stating the endpoint uri is not valid. </p></td></ tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>cacheSize</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>1000</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.13.1/2.12.4:</strong> Allows to configure the cache size for the <code>ProducerCache</code> which caches producers for reuse in the routing slip. Will by default use the default cache size which is 1000. Setting the value to -1 allows to turn off the cache all together. </p></td></tr></tbody></table> + <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>uriDelimiter</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>,</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Delimiter used if the <a shape="rect" href="expression.html">Expression</a> returned multiple endpoints.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ignoreInvalidEndpoints</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>If an endpoint URI could not be resolved, should it be ignored.</p><p>Otherwise, Camel will throw an exception stating the endpoint URI is not valid.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>cacheSize</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.13.1/2.12.4:</strong> Allows to configure the cache size for the <strong><code>ProducerCache</code></strong> which caches producers for reuse in the routing slip.</p><p>The default cache size which is <strong><code>1000</code></strong>.</p><p>A value of <strong><code>-1</code></strong> disables the use of the cache.</p></td></tr></tbody></table> </div> -</div><h4 id="BookPatternAppendix-Example.3">Example</h4><p>The following route will take any messages sent to the <a shape="rect" class="external-link" href="http://activemq.apache.org">Apache ActiveMQ</a> queue <strong>SomeQueue</strong> and pass them into the <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/RoutingTable.html" rel="nofollow">Routing Slip</a> pattern.</p><div class="code panel pdl" style="border-width: 1px;"> +</div><h4 id="BookPatternAppendix-Example.3">Example</h4><p>The following route will take any messages sent to the <a shape="rect" class="external-link" href="http://activemq.apache.org">Apache ActiveMQ</a> queue <strong><code>SomeQueue</code></strong> and pass them into the <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/RoutingTable.html" rel="nofollow">Routing Slip</a> pattern.</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">from(&quot;activemq:SomeQueue&quot;).routingSlip(&quot;aRoutingSlipHeader&quot;); </script> + <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">from(&quot;activemq:SomeQueue&quot;) .routingSlip(&quot;aRoutingSlipHeader&quot;); </script> </div> -</div><p>Messages will be checked for the existance of the "aRoutingSlipHeader" header. The value of this header should be a comma-delimited list of endpoint <a shape="rect" href="uris.html">URIs</a> you wish the message to be routed to. The <a shape="rect" href="message.html">Message</a> will be routed in a <a shape="rect" href="pipes-and-filters.html">pipeline</a> fashion (i.e. one after the other).</p><p>From Camel 2.5 the <a shape="rect" href="routing-slip.html">Routing Slip</a> will set a property (<code>Exchange.SLIP_ENDPOINT</code>) on the <a shape="rect" href="exchange.html">Exchange</a> which contains the current endpoint as it advanced though the slip. This allows you to <em>know</em> how far we have processed in the slip.</p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> will compute the slip <strong>beforehand</strong> which means, the slip is only computed once. If you need to compute the slip <em>on-the-fly</em> then use the <a shape="rect" href="dyna mic-router.html">Dynamic Router</a> pattern instead.</p><h4 id="BookPatternAppendix-Configurationoptions">Configuration options</h4><p>Here we set the header name and the URI delimiter to something different.</p><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"> from(&quot;direct:c&quot;).routingSlip(header(&quot;aRoutingSlipHeader&quot;), &quot;#&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><p>Messages will be checked for the existence of the <strong><code>aRoutingSlipHeader</code></strong> header. The value of this header should be a comma-delimited list of endpoint <a shape="rect" href="uris.html">URIs</a> you wish the message to be routed to. The <a shape="rect" href="message.html">Message</a> will be routed in a <a shape="rect" href="pipes-and-filters.html">pipeline</a> fashion, i.e., one after the other. From <strong>Camel 2.5</strong> the <a shape="rect" href="routing-slip.html">Routing Slip</a> will set a property, <strong><code>Exchange.SLIP_ENDPOINT</code>, </strong>on the <a shape="rect" href="exchange.html">Exchange</a> which contains the current endpoint as it advanced though the slip. This allows you to <em>know</em> how far we have processed in the slip.</p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> will compute the slip <strong>beforehand</strong> which means, the slip is only computed once. If you need to compute the sli p <em>on-the-fly</em> then use the <a shape="rect" href="dynamic-router.html">Dynamic Router</a> pattern instead.</p><h4 id="BookPatternAppendix-ConfigurationOptions">Configuration Options</h4><p>Here we set the header name and the URI delimiter to something different.</p><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"> from(&quot;direct:c&quot;).routingSlip(header(&quot;aRoutingSlipHeader&quot;), &quot;#&quot;); </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: java; gutter: false; theme: Default" type="syntaxhighlighter">&lt;camelContext id=&quot;buildRoutingSlip&quot; xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot;&gt; &lt;route&gt; &lt;from uri=&quot;direct:c&quot;/&gt; &lt;routingSlip uriDelimiter=&quot;#&quot;&gt; &lt;header&gt;aRoutingSlipHeader&lt;/header&gt; &lt;/routingSlip&gt; &lt;/route&gt; &lt;/camelContext&gt; </script> </div> -</div><h3 id="BookPatternAppendix-Ignoreinvalidendpoints.1">Ignore invalid endpoints</h3><p><strong>Available as of Camel 2.3</strong></p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> now supports <code>ignoreInvalidEndpoints</code> which the <a shape="rect" href="recipient-list.html">Recipient List</a> also supports. You can use it to skip endpoints which are invalid.</p><div class="code panel pdl" style="border-width: 1px;"> +</div><h3 id="BookPatternAppendix-IgnoreInvalidEndpoints">Ignore Invalid Endpoints</h3><p><strong>Available as of Camel 2.3</strong></p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> now supports <strong><code>ignoreInvalidEndpoints</code></strong> which the <a shape="rect" href="recipient-list.html">Recipient List</a> also supports. You can use it to skip endpoints which are invalid.</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"> from(&quot;direct:a&quot;).routingSlip(&quot;myHeader&quot;).ignoreInvalidEndpoints(); </script> + <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">from(&quot;direct:a&quot;) .routingSlip(&quot;myHeader&quot;) .ignoreInvalidEndpoints(); </script> </div> -</div><p>And in Spring XML its an attribute on the recipient list tag.</p><div class="code panel pdl" style="border-width: 1px;"> +</div><p>And in Spring XML its an attribute on the recipient list tag:</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"> &lt;route&gt; &lt;from uri=&quot;direct:a&quot;/&gt; &lt;routingSlip ignoreInvalidEndpoints=&quot;true&quot;/&gt; &lt;header&gt;myHeader&lt;/header&gt; &lt;/routingSlip&gt; &lt;/route&gt; </script> + <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;route&gt; &lt;from uri=&quot;direct:a&quot;/&gt; &lt;routingSlip ignoreInvalidEndpoints=&quot;true&quot;/&gt; &lt;header&gt;myHeader&lt;/header&gt; &lt;/routingSlip&gt; &lt;/route&gt; </script> </div> -</div><p>Then lets say the <code>myHeader</code> contains the following two endpoints <code>direct:foo,xxx:bar</code>. The first endpoint is valid and works. However the 2nd is invalid and will just be ignored. Camel logs at INFO level, so you can see why the endpoint was invalid.</p><h3 id="BookPatternAppendix-Expressionsupporting">Expression supporting</h3><p><strong>Available as of Camel 2.4</strong></p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> now supports to take the expression parameter as the <a shape="rect" href="recipient-list.html">Recipient List</a> does. You can tell Camel the expression that you want to use to get the routing slip.</p><div class="code panel pdl" style="border-width: 1px;"> +</div><p>Then let's say the <strong><code>myHeader</code></strong> contains the following two endpoints <strong><code>direct:foo,xxx:bar</code></strong>. The first endpoint is valid and works. However the second endpoint is invalid and will just be ignored. Camel logs at <strong><code>INFO</code></strong> level, so you can see why the endpoint was invalid.</p><h3 id="BookPatternAppendix-ExpressionSupport">Expression Support</h3><p><strong>Available as of Camel 2.4</strong></p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> now supports to take the expression parameter as the <a shape="rect" href="recipient-list.html">Recipient List</a> does. You can tell Camel the expression that you want to use to get the routing slip.</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"> from(&quot;direct:a&quot;).routingSlip(header(&quot;myHeader&quot;)).ignoreInvalidEndpoints(); </script> + <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">from(&quot;direct:a&quot;) .routingSlip(header(&quot;myHeader&quot;)) .ignoreInvalidEndpoints(); </script> </div> </div><p>And in Spring XML its an attribute on the recipient list tag.</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"> &lt;route&gt; &lt;from uri=&quot;direct:a&quot;/&gt; &lt;!--NOTE from Camel 2.4.0, you need to specify the expression element inside of the routingSlip element --&gt; &lt;routingSlip ignoreInvalidEndpoints=&quot;true&quot;&gt; &lt;header&gt;myHeader&lt;/header&gt; &lt;/routingSlip&gt; &lt;/route&gt; </script> + <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;route&gt; &lt;from uri=&quot;direct:a&quot;/&gt; &lt;!--NOTE from Camel 2.4.0, you need to specify the expression element inside of the routingSlip element --&gt; &lt;routingSlip ignoreInvalidEndpoints=&quot;true&quot;&gt; &lt;header&gt;myHeader&lt;/header&gt; &lt;/routingSlip&gt; &lt;/route&gt; </script> </div> </div><h4 id="BookPatternAppendix-FurtherExamples.1">Further Examples</h4><p>For further examples of this pattern in use you could look at the <a shape="rect" class="external-link" href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/routingslip">routing slip test cases</a>.</p><p></p><h4 id="BookPatternAppendix-UsingThisPattern.23">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><h3 id="BookPatternAppendix-Throttler">Throttler</h3><p>The Throttler Pattern allows you to ensure that a specific endp oint does not get overloaded, or that we don't exceed an agreed SLA with some external service.</p><h3 id="BookPatternAppendix-Options.4">Options</h3><div class="confluenceTableSmall"> <div class="table-wrap"> Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available. Modified: websites/production/camel/content/routing-slip.html ============================================================================== --- websites/production/camel/content/routing-slip.html (original) +++ websites/production/camel/content/routing-slip.html Mon Feb 20 17:21:19 2017 @@ -87,15 +87,16 @@ <tr> <td valign="top" width="100%"> <div class="wiki-content maincontent"><h3 id="RoutingSlip-RoutingSlip">Routing Slip</h3><p>The <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/RoutingTable.html" rel="nofollow">Routing Slip</a> from the <a shape="rect" href="enterprise-integration-patterns.html">EIP patterns</a> allows you to route a message consecutively through a series of processing steps where the sequence of steps is not known at design time and can vary for each message.</p><p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image confluence-external-resource" src="http://www.enterpriseintegrationpatterns.com/img/RoutingTableSimple.gif" data-image-src="http://www.enterpriseintegrationpatterns.com/img/RoutingTableSimple.gif"></span></p><h3 id="RoutingSlip-Options">Options</h3><div class="confluenceTableSmall"><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>uriDelimiter</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>,</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Delimiter used if the <a shape="rect" href="expression.html">Expression</a> returned multiple endpoints. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>ignoreInvalidEndpoints</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> If an endpoint uri could not be resolved, should it be ignored. Otherwise Camel will throw an exception stating the endpoint uri is not valid. </p></td></t r><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>cacheSize</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>1000</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.13.1/2.12.4:</strong> Allows to configure the cache size for the <code>ProducerCache</code> which caches producers for reuse in the routing slip. Will by default use the default cache size which is 1000. Setting the value to -1 allows to turn off the cache all together. </p></td></tr></tbody></table> -</div></div><h4 id="RoutingSlip-Example">Example</h4><p>The following route will take any messages sent to the <a shape="rect" class="external-link" href="http://activemq.apache.org">Apache ActiveMQ</a> queue <strong>SomeQueue</strong> and pass them into the <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/RoutingTable.html" rel="nofollow">Routing Slip</a> pattern.</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("activemq:SomeQueue").routingSlip("aRoutingSlipHeader"); + <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>uriDelimiter</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>,</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Delimiter used if the <a shape="rect" href="expression.html">Expression</a> returned multiple endpoints.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ignoreInvalidEndpoints</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>If an endpoint URI could not be resolved, should it be ignored.</p><p>Otherwise, Camel will throw an exception stating the endpoint URI is not valid.</p></td></tr><tr><td c olspan="1" rowspan="1" class="confluenceTd"><p><code>cacheSize</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.13.1/2.12.4:</strong> Allows to configure the cache size for the <strong><code>ProducerCache</code></strong> which caches producers for reuse in the routing slip.</p><p>The default cache size which is <strong><code>1000</code></strong>.</p><p>A value of <strong><code>-1</code></strong> disables the use of the cache.</p></td></tr></tbody></table> +</div></div><h4 id="RoutingSlip-Example">Example</h4><p>The following route will take any messages sent to the <a shape="rect" class="external-link" href="http://activemq.apache.org">Apache ActiveMQ</a> queue <strong><code>SomeQueue</code></strong> and pass them into the <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/RoutingTable.html" rel="nofollow">Routing Slip</a> pattern.</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("activemq:SomeQueue") + .routingSlip("aRoutingSlipHeader"); ]]></script> -</div></div><p>Messages will be checked for the existance of the "aRoutingSlipHeader" header. The value of this header should be a comma-delimited list of endpoint <a shape="rect" href="uris.html">URIs</a> you wish the message to be routed to. The <a shape="rect" href="message.html">Message</a> will be routed in a <a shape="rect" href="pipes-and-filters.html">pipeline</a> fashion (i.e. one after the other).</p><p>From Camel 2.5 the <a shape="rect" href="routing-slip.html">Routing Slip</a> will set a property (<code>Exchange.SLIP_ENDPOINT</code>) on the <a shape="rect" href="exchange.html">Exchange</a> which contains the current endpoint as it advanced though the slip. This allows you to <em>know</em> how far we have processed in the slip.</p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> will compute the slip <strong>beforehand</strong> which means, the slip is only computed once. If you need to compute the slip <em>on-the-fly</em> then use the <a shape="rect" href ="dynamic-router.html">Dynamic Router</a> pattern instead.</p><h4 id="RoutingSlip-Configurationoptions">Configuration options</h4><p>Here we set the header name and the URI delimiter to something different.</p><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></div><p>Messages will be checked for the existence of the <strong><code>aRoutingSlipHeader</code></strong> header. The value of this header should be a comma-delimited list of endpoint <a shape="rect" href="uris.html">URIs</a> you wish the message to be routed to. The <a shape="rect" href="message.html">Message</a> will be routed in a <a shape="rect" href="pipes-and-filters.html">pipeline</a> fashion, i.e., one after the other. From <strong>Camel 2.5</strong> the <a shape="rect" href="routing-slip.html">Routing Slip</a> will set a property, <strong><code>Exchange.SLIP_ENDPOINT</code>, </strong>on the <a shape="rect" href="exchange.html">Exchange</a> which contains the current endpoint as it advanced though the slip. This allows you to <em>know</em> how far we have processed in the slip.</p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> will compute the slip <strong>beforehand</strong> which means, the slip is only computed once. If you need to compute t he slip <em>on-the-fly</em> then use the <a shape="rect" href="dynamic-router.html">Dynamic Router</a> pattern instead.</p><h4 id="RoutingSlip-ConfigurationOptions">Configuration Options</h4><p>Here we set the header name and the URI delimiter to something different.</p><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("direct:c").routingSlip(header("aRoutingSlipHeader"), "#"); ]]></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: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[<camelContext id="buildRoutingSlip" xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="direct:c"/> @@ -105,28 +106,32 @@ from("direct:c").routingSlip(h </route> </camelContext> ]]></script> -</div></div><h3 id="RoutingSlip-Ignoreinvalidendpoints">Ignore invalid endpoints</h3><p><strong>Available as of Camel 2.3</strong></p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> now supports <code>ignoreInvalidEndpoints</code> which the <a shape="rect" href="recipient-list.html">Recipient List</a> also supports. You can use it to skip endpoints which are invalid.</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:a").routingSlip("myHeader").ignoreInvalidEndpoints(); +</div></div><h3 id="RoutingSlip-IgnoreInvalidEndpoints">Ignore Invalid Endpoints</h3><p><strong>Available as of Camel 2.3</strong></p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> now supports <strong><code>ignoreInvalidEndpoints</code></strong> which the <a shape="rect" href="recipient-list.html">Recipient List</a> also supports. You can use it to skip endpoints which are invalid.</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:a") + .routingSlip("myHeader") + .ignoreInvalidEndpoints(); +]]></script> +</div></div><p>And in Spring XML its an attribute on the recipient list tag:</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:a"/> + <routingSlip ignoreInvalidEndpoints="true"/> + <header>myHeader</header> + </routingSlip> +</route> +]]></script> +</div></div><p>Then let's say the <strong><code>myHeader</code></strong> contains the following two endpoints <strong><code>direct:foo,xxx:bar</code></strong>. The first endpoint is valid and works. However the second endpoint is invalid and will just be ignored. Camel logs at <strong><code>INFO</code></strong> level, so you can see why the endpoint was invalid.</p><h3 id="RoutingSlip-ExpressionSupport">Expression Support</h3><p><strong>Available as of Camel 2.4</strong></p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> now supports to take the expression parameter as the <a shape="rect" href="recipient-list.html">Recipient List</a> does. You can tell Camel the expression that you want to use to get the routing slip.</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:a") + .routingSlip(header("myHeader")) + .ignoreInvalidEndpoints(); ]]></script> </div></div><p>And in Spring XML its an attribute on the recipient list tag.</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[ <route> - <from uri="direct:a"/> - <routingSlip ignoreInvalidEndpoints="true"/> - <header>myHeader</header> - </routingSlip> - </route> -]]></script> -</div></div><p>Then lets say the <code>myHeader</code> contains the following two endpoints <code>direct:foo,xxx:bar</code>. The first endpoint is valid and works. However the 2nd is invalid and will just be ignored. Camel logs at INFO level, so you can see why the endpoint was invalid.</p><h3 id="RoutingSlip-Expressionsupporting">Expression supporting</h3><p><strong>Available as of Camel 2.4</strong></p><p>The <a shape="rect" href="routing-slip.html">Routing Slip</a> now supports to take the expression parameter as the <a shape="rect" href="recipient-list.html">Recipient List</a> does. You can tell Camel the expression that you want to use to get the routing slip.</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:a").routingSlip(header("myHeader")).ignoreInvalidEndpoints(); -]]></script> -</div></div><p>And in Spring XML its an attribute on the recipient list tag.</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[ <route> - <from uri="direct:a"/> - <!--NOTE from Camel 2.4.0, you need to specify the expression element inside of the routingSlip element --> - <routingSlip ignoreInvalidEndpoints="true"> - <header>myHeader</header> - </routingSlip> - </route> +<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[<route> + <from uri="direct:a"/> + <!--NOTE from Camel 2.4.0, you need to specify the expression element inside of the routingSlip element --> + <routingSlip ignoreInvalidEndpoints="true"> + <header>myHeader</header> + </routingSlip> +</route> ]]></script> </div></div><h4 id="RoutingSlip-FurtherExamples">Further Examples</h4><p>For further examples of this pattern in use you could look at the <a shape="rect" class="external-link" href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/routingslip">routing slip test cases</a>.</p><p></p><h4 id="RoutingSlip-UsingThisPattern">Using This Pattern</h4>