Author: buildbot Date: Mon Jul 20 17:18:32 2015 New Revision: 959042 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/advicewith.html websites/production/camel/content/cache/main.pageCache Modified: websites/production/camel/content/advicewith.html ============================================================================== --- websites/production/camel/content/advicewith.html (original) +++ websites/production/camel/content/advicewith.html Mon Jul 20 17:18:32 2015 @@ -110,7 +110,7 @@ public void testAdvised() throws Excepti assertMockEndpointsSatisfied(); } ]]></script> -</div></div><div class="confluence-information-macro confluence-information-macro-warning"><p class="title">Recommendation</p><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>It is recommended to only advice a given route once (you can of course advice multiple routes). If you do it multiple times, then it may not work as expected, especially when any kind of error handling is involved.<br clear="none"> The Camel team plan for Camel 3.0 to support this as internal refactorings in the routing engine is needed to support this properly.</p></div></div><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Telling Camel you are using adviceWith</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>From <strong>Camel 2.9</strong> onwards its recommended to override the <code>isUseAdviceWith</code> method and return true to tell Camel you are using advice with in your unit tests. Then after you have done the adviceWith, then you must start <code>CamelContext</code> manually. See further below for an example.</p></div></div><h3 id="AdviceWith-UsingAdviceWithRouteBuilder">Using AdviceWithRouteBuilder</h3><p><strong>Available as of Camel 2.7</strong></p><p>The <code>AdviceWithRouteBuilder</code> is a specialized <code>RouteBuilder</code> which has additional methods for advising routes. For example this allows you to manipulate the advised route, such as replacing a node with some other nodes.</p><p>The <code>AdviceWithRouteBuilder</code> offers the following extra methods</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Method</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>< code>mockEndpoints</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Is used to easily mock all endpoints. See more details and examples at <a shape="rect" href="mock.html">Mock</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mockEndpoints(patterns)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Is used to easily mock endpoints using a pattern. See more details and examples at <a shape="rect" href="mock.html">Mock</a>. See below for pattern matching. From Camel 2.10 onwards you can specify multiple patterns.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mockEndpointsAndSkip(patterns)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Is used to easily mock endpoints using a pattern, and <strong>skip</strong> sending to the original endpoint. See more details and examples at <a shape="rect" href="mock.html">Mock</a>. See below for pattern matching. You can specify multipl e patterns.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>weaveById(pattern)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Is used to select node(s) matching by id's, and weave in the following nodes. See below for pattern matching and examples.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>weaveByToString(pattern)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Is used to select nodes(s) matching by their <code>toString</code> representation, and weave in the following nodes. See below for pattern matching and examples.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>weaveByType(Class)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> Is used to select node(s) matching by their class type (the classes from the org.apache.camel.model package), and weave in the following nodes. See below for examples.</p></td></tr><t r><td colspan="1" rowspan="1" class="confluenceTd"><p><code>weaveAddFirst</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> Is a short hand to easily weave in the following nodes in the start of the route.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>weaveAddLast</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> Is a short hand to easily weave in the following nodes in the end of the route.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>replaceFromWith(uri)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> To replace the route input with a new endpoint uri.</p></td></tr></tbody></table></div><p>The <code>pattern</code> option is used for matching. It uses the same rules as the <a shape="rect" href="intercept.html">Intercept</a>, which is applied in the following order:</p><ul><li>match exact</ li><li>match by wildcard</li><li>match by regular expression</li></ul><p>For example to match exact you can use <code>weaveById("foo")</code> which will match only the id in the route which has the value <code>"foo"</code>.<br clear="none"> The wildcard is when the pattern ends with a * char, such as: <code>weaveById("foo*")</code> which will match any id's starting with <code>"foo"</code>, such as <code>foo, foobar, foobie</code> and so forth.<br clear="none"> The regular expression is more advanced and allows you to match multiple ids, such as <code>weaveById("(foo|bar)")</code> which will match both <code>"foo"</code> and <code>"bar"</code>.</p><div class="confluence-information-macro confluence-information-macro-tip"><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If you try to match a <code>pattern</code> on an exact endpoint uri, then mind that URI options ordering may influen ce, and hence its best to match by wildcard. For example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><div class="confluence-information-macro confluence-information-macro-warning"><p class="title">Recommendation</p><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>It is recommended to only advice a given route once (you can of course advice multiple routes). If you do it multiple times, then it may not work as expected, especially when any kind of error handling is involved.<br clear="none"> The Camel team plan for Camel 3.0 to support this as internal refactorings in the routing engine is needed to support this properly.</p></div></div><div class="confluence-information-macro confluence-information-macro-warning"><p class="title">Recommendation</p><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>It's recommended to only advice routes which are not started already.<br clear="n one"> If you advice already started routes, then it may not work as expected.</p></div></div><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Telling Camel you are using adviceWith</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>From <strong>Camel 2.9</strong> onwards its recommended to override the <code>isUseAdviceWith</code> method and return true to tell Camel you are using advice with in your unit tests. Then after you have done the adviceWith, then you must start <code>CamelContext</code> manually. See further below for an example.</p></div></div><h3 id="AdviceWith-UsingAdviceWithRouteBuilder">Using AdviceWithRouteBuilder</h3><p><strong>Available as of Camel 2.7</strong></p><p>The <code>AdviceWithRouteBuilder</code> is a specialized <code>RouteBuilder</code> which has additional methods for advising routes. For example this allows you to manipulate the advised route, such as replacing a node with some other nodes.</p><p>The <code>AdviceWithRouteBuilder</code> offers the following extra methods</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Method</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mockEndpoints</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Is used to easily mock all endpoints. See more details and examples at <a shape="rect" href="mock.html">Mock</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mockEndpoints(patterns)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Is used to easily mock endpoints using a pattern. See more details and examples at <a shape="rect" href="mock.html">Mock</a>. See below for pattern matching. From Camel 2.10 onwards you can speci fy multiple patterns.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mockEndpointsAndSkip(patterns)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Is used to easily mock endpoints using a pattern, and <strong>skip</strong> sending to the original endpoint. See more details and examples at <a shape="rect" href="mock.html">Mock</a>. See below for pattern matching. You can specify multiple patterns.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>weaveById(pattern)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Is used to select node(s) matching by id's, and weave in the following nodes. See below for pattern matching and examples.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>weaveByToString(pattern)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Is used to select nodes(s) matching by their <code>toString</code> representation, and weave in th e following nodes. See below for pattern matching and examples.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>weaveByType(Class)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> Is used to select node(s) matching by their class type (the classes from the org.apache.camel.model package), and weave in the following nodes. See below for examples.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>weaveAddFirst</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> Is a short hand to easily weave in the following nodes in the start of the route.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>weaveAddLast</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> Is a short hand to easily weave in the following nodes in the end of the route.</p></td></tr><tr><td colspan="1" rowspan="1" cl ass="confluenceTd"><p><code>replaceFromWith(uri)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> To replace the route input with a new endpoint uri.</p></td></tr></tbody></table></div><p>The <code>pattern</code> option is used for matching. It uses the same rules as the <a shape="rect" href="intercept.html">Intercept</a>, which is applied in the following order:</p><ul><li>match exact</li><li>match by wildcard</li><li>match by regular expression</li></ul><p>For example to match exact you can use <code>weaveById("foo")</code> which will match only the id in the route which has the value <code>"foo"</code>.<br clear="none"> The wildcard is when the pattern ends with a * char, such as: <code>weaveById("foo*")</code> which will match any id's starting with <code>"foo"</code>, such as <code>foo, foobar, foobie</code> and so forth.<br clear="none"> The regular expression is more advanced and allows you to match multiple ids, such as <code>wea veById("(foo|bar)")</code> which will match both <code>"foo"</code> and <code>"bar"</code>.</p><div class="confluence-information-macro confluence-information-macro-tip"><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If you try to match a <code>pattern</code> on an exact endpoint uri, then mind that URI options ordering may influence, and hence its best to match by wildcard. For example:</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[mockEndpointsAndSkip("activemq:queue:foo?*") ]]></script> </div></div><p>To match the foo queue and disregard any options.</p></div></div><h3 id="AdviceWith-UsingweaveById">Using weaveById</h3><p>The <code>weaveById</code> allows you to manipulate the route, for example by replacing a node with other nodes. The following methods is available:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Method</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>remove</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Removes the selected node(s).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>replace</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Replaces the selected node(s) with the following nodes.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>before</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Before the selected node(s), the following nodes is added.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>after</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>After the selected node(s), the following nodes is added.</p></td></tr></tbody></table></div><p>For example given the following route:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Route</b></div><div class="codeContent panelContent pdl"> @@ -130,7 +130,7 @@ context.getRouteDefinitions().get(0).adv } }); ]]></script> -</div></div><p>In this example we replace the <code>.to("mock:bar").id("bar")</code> with the <code>.multicast().to("mock:a").to("mock:b")</code>.<br clear="none"> That means instead of sending the message to a <code>"mock:bar"</code> endpoint, we do a <a shape="rect" href="multicast.html">Multicast</a> to <code>"mock:a"</code> and <code>"mock:b"</code> endpoints instead.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Remove</b></div><div class="codeContent panelContent pdl"> +</div></div>In this example we replace the <code>.to("mock:bar").id("bar")</code> with the <code>.multicast().to("mock:a").to("mock:b")</code>.<br clear="none"> That means instead of sending the message to a <code>"mock:bar"</code> endpoint, we do a <a shape="rect" href="multicast.html">Multicast</a> to <code>"mock:a"</code> and <code>"mock:b"</code> endpoints instead.<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Remove</b></div><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() { @Override @@ -140,7 +140,7 @@ context.getRouteDefinitions().get(0).adv } }); ]]></script> -</div></div><p>In the example above, we simply just remove the <code>.to("mock:bar").id("bar")</code>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Before</b></div><div class="codeContent panelContent pdl"> +</div></div>In the example above, we simply just remove the <code>.to("mock:bar").id("bar")</code>.<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Before</b></div><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() { @Override @@ -151,7 +151,7 @@ context.getRouteDefinitions().get(0).adv } }); ]]></script> -</div></div><p>In the example above, we add the following nodes <code>to("mock:a").transform(constant("Bye World"))</code> <strong>before</strong> the node with the id <code>"bar"</code>.<br clear="none"> That means the message being send to <code>"mock:bar"</code> would have been transformed to a constant message "Bye World".</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>After</b></div><div class="codeContent panelContent pdl"> +</div></div>In the example above, we add the following nodes <code>to("mock:a").transform(constant("Bye World"))</code> <strong>before</strong> the node with the id <code>"bar"</code>.<br clear="none"> That means the message being send to <code>"mock:bar"</code> would have been transformed to a constant message "Bye World".<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>After</b></div><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() { @Override @@ -162,7 +162,7 @@ context.getRouteDefinitions().get(0).adv } }); ]]></script> -</div></div><p>In the example above, we add the following nodes <code>to("mock:a").transform(constant("Bye World"))</code> <strong>after</strong> the node with the id <code>"bar"</code>.</p><h3 id="AdviceWith-UsingweaveByToString">Using weaveByToString</h3><p>The <code>weaveByToString</code> also allows you to manipulate the route, for example by replacing a node with other nodes. As opposed to <code>weaveById</code>, this method uses the <code>toString</code> representation of the node(s) when matching. This allows you to match nodes, which may not have assigned ids, or to match <a shape="rect" href="eip.html">EIP</a> pattern.<br clear="none"> You have to be a bit more careful when using this as the <code>toString</code> representation can be verbose and contain characters such as [ ] ( ) -> and so forth. That is why using the regular expression matching is the must useable.</p><p>The <code>weaveByToString</code> has the same methods as <code>weaceById</code>.</p><p>For example to replace any nodes which has <code>"foo"</code> you can do</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Replace</b></div><div class="codeContent panelContent pdl"> +</div></div>In the example above, we add the following nodes <code>to("mock:a").transform(constant("Bye World"))</code> <strong>after</strong> the node with the id <code>"bar"</code>.<h3 id="AdviceWith-UsingweaveByToString">Using weaveByToString</h3><p>The <code>weaveByToString</code> also allows you to manipulate the route, for example by replacing a node with other nodes. As opposed to <code>weaveById</code>, this method uses the <code>toString</code> representation of the node(s) when matching. This allows you to match nodes, which may not have assigned ids, or to match <a shape="rect" href="eip.html">EIP</a> pattern.<br clear="none"> You have to be a bit more careful when using this as the <code>toString</code> representation can be verbose and contain characters such as [ ] ( ) -> and so forth. That is why using the regular expression matching is the must useable.</p><p>The <code>weaveByToString</code> has the same methods as <code>weaceById</code>.</p><p>For example to repl ace any nodes which has <code>"foo"</code> you can do</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Replace</b></div><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() { @Override @@ -173,14 +173,14 @@ context.getRouteDefinitions().get(0).adv } }); ]]></script> -</div></div><p>Notice that we have to use <code>".<strong>foo.</strong>"</code> in the pattern to match that <code>"foo"</code> is present anywhere in the string.</p><h3 id="AdviceWith-UsingweaveByType">Using weaveByType</h3><p><strong>Available as of Camel 2.8</strong></p><p>The <code>weaveByToType</code> also allows you to manipulate the route, for example by replacing a node with other nodes. As opposed to <code>weaveById</code>, and <code>weaveByToString</code> this method uses the class type of the node(s) when matching. This allows you to match <a shape="rect" href="eip.html">EIP</a> pattern by its type.</p><p>The <code>weaveByToType</code> has the same methods as <code>weaceById</code> and <code>weaveByToString</code>.</p><p>For example to remove a transform from the following route:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Route</b></div><div class="codeContent panelContent pdl"> +</div></div>Notice that we have to use <code>".<strong>foo.</strong>"</code> in the pattern to match that <code>"foo"</code> is present anywhere in the string.<h3 id="AdviceWith-UsingweaveByType">Using weaveByType</h3><p><strong>Available as of Camel 2.8</strong></p><p>The <code>weaveByToType</code> also allows you to manipulate the route, for example by replacing a node with other nodes. As opposed to <code>weaveById</code>, and <code>weaveByToString</code> this method uses the class type of the node(s) when matching. This allows you to match <a shape="rect" href="eip.html">EIP</a> pattern by its type.</p><p>The <code>weaveByToType</code> has the same methods as <code>weaceById</code> and <code>weaveByToString</code>.</p><p>For example to remove a transform from the following route:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Route</b></div><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ from("direct:start") .transform(simple("Hello ${body}")) .log("Got ${body}") .to("mock:result"); ]]></script> -</div></div><p>You can do:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Remove</b></div><div class="codeContent panelContent pdl"> +</div></div>You can do:<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Remove</b></div><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() { @Override Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available.