Modified: websites/production/camel/content/seda.html
==============================================================================
--- websites/production/camel/content/seda.html (original)
+++ websites/production/camel/content/seda.html Fri Aug 25 10:20:13 2017
@@ -36,17 +36,6 @@
     <![endif]-->
 
 
-  <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css' 
rel='stylesheet' type='text/css' />
-  <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' 
rel='stylesheet' type='text/css' />
-  <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' 
type='text/javascript'></script>
-  
-  <script type="text/javascript">
-  SyntaxHighlighter.defaults['toolbar'] = false;
-  SyntaxHighlighter.all();
-  </script>
 
     <title>
     Apache Camel: SEDA
@@ -86,101 +75,41 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="SEDA-SEDAComponent">SEDA 
Component</h2><p>The <strong><code>seda:</code></strong> component provides 
asynchronous&#160;<a shape="rect" class="external-link" 
href="https://en.wikipedia.org/wiki/Staged_event-driven_architecture"; 
rel="nofollow">SEDA</a> behavior, so that messages are exchanged on a 
BlockingQueue and consumers are invoked in a separate thread from the 
producer.<a shape="rect" class="external-link" 
href="http://www.eecs.harvard.edu/~mdw/proj/seda/"; 
rel="nofollow"></a></p><p>Note that queues are only visible within a 
<em>single</em> <a shape="rect" href="camelcontext.html">CamelContext</a>. If 
you want to communicate across <strong><code>CamelContext</code></strong> 
instances (for example, communicating between Web applications), see the <a 
shape="rect" href="vm.html">VM</a> component.</p><p>This component does not 
implement any kind of persistence or recovery, if the VM terminates while 
messages are yet to be processed. If yo
 u need persistence, reliability or distributed SEDA, try using either <a 
shape="rect" href="jms.html">JMS</a> or <a shape="rect" 
href="activemq.html">ActiveMQ</a>.</p><div class="confluence-information-macro 
confluence-information-macro-tip"><p class="title">Synchronous</p><span 
class="aui-icon aui-icon-small aui-iconfont-approve 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>The <a shape="rect" 
href="direct.html">Direct</a> component provides synchronous invocation of any 
consumers when a producer sends a message exchange.</p></div></div><h3 
id="SEDA-URIformat">URI format</h3><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[seda:someName[?options]
-]]></script>
-</div></div><p>Where&#160;<strong><code>someName</code></strong> can be any 
string that uniquely identifies the endpoint within the current <a shape="rect" 
href="camelcontext.html">CamelContext</a>.</p><p>You can append query options 
to the URI in the following format: 
<strong><code>?option=value&amp;option=value&amp;...</code></strong></p><h3 
id="SEDA-Options">Options</h3><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Since</p></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>size</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>The maximum capacity of t
 he&#160;<strong>seda</strong> queue, i.e., the number of messages it can 
hold.</p><p>The default value in <strong>Camel 2.2</strong> or older is 
<strong><code>1000</code></strong>.</p><p>From <strong>Camel 2.3</strong>: the 
size is unbounded by default.</p><p>&#160;</p><div 
class="confluence-information-macro confluence-information-macro-warning"><span 
class="aui-icon aui-icon-small aui-iconfont-error 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p><strong>Note:</strong> Care should 
be taken when using this option. The size is determined by the value specified 
<em>when the first endpoint is created</em>. Each endpoint must therefore 
specify the same size.</p><p><strong>From</strong> <strong>Camel 2.11</strong>: 
a validation is taken place to ensure if using mixed queue sizes for the same 
queue name, Camel would detect this and fail creating the 
endpoint.</p></div></div></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code
 >concurrentConsumers</code></p></td><td colspan="1" rowspan="1" 
 >class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>1</code></p></td><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p>Number of concurrent threads processing 
 >exchanges.</p></td></tr><tr><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>waitForTaskToComplete</code></p></td><td 
 >colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" 
 >rowspan="1" class="confluenceTd"><p><code>IfReplyExpected</code></p></td><td 
 >colspan="1" rowspan="1" class="confluenceTd"><p>Option to specify whether the 
 >caller should wait for the asynchronous task to complete before 
 >continuing.</p><p>The following options are 
 >supported:</p><ul><li><p><strong><code>Always</code></strong></p></li><li><p><strong><code>Never</code></strong></p></li><li><p><strong><code>IfReplyExpected</code></strong></p></li></ul><p>The
 > first two values are self-explanatory.</p><p>The last value, 
 ><strong><code>IfR
 eplyExpected</code></strong>, will only wait if the message is <a shape="rect" 
href="request-reply.html">Request Reply</a> based.</p><p>See <a shape="rect" 
href="async.html">Async</a> messaging for more details.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>timeout</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>30000</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Timeout (in milliseconds) before 
a&#160;<strong>seda</strong> producer will stop waiting for an asynchronous 
task to complete.</p><p>See <strong><code>waitForTaskToComplete</code></strong> 
and <a shape="rect" href="async.html">Async</a> for more details.</p><p>From 
<strong>Camel 2.2:</strong> you can now disable timeout by 
using&#160;<strong><code>0</code></strong> or a negative 
value.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>multipleConsumers</code></p></td
 ><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><strong>2.2</strong></p></td><td colspan="1" 
 >rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
 >colspan="1" rowspan="1" class="confluenceTd"><p>Specifies whether multiple 
 >consumers are allowed. If enabled, you can use <a shape="rect" 
 >href="seda.html">SEDA</a> for <a shape="rect" class="external-link" 
 >href="http://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern"; 
 >rel="nofollow">Publish-Subscribe</a> messaging. That is, you can send a 
 >message to the&#160;<strong>seda</strong> queue and have each consumer 
 >receive a copy of the message. When enabled, this option should be specified 
 >on every consumer endpoint.</p></td></tr><tr><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>limitConcurrentConsumers</code></p></td><td 
 >colspan="1" rowspan="1" 
 >class="confluenceTd"><p><strong>2.3</strong></p></td><td colspan="1" 
 >rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" 
 >rowspan="1" class=
 "confluenceTd"><p>Whether to limit the number of 
<strong><code>concurrentConsumers</code></strong> to the maximum of 
<strong><code>500</code></strong>.</p><p>By default, an exception will be 
thrown if a&#160;<strong>seda</strong> endpoint is configured with a greater 
number. You can disable that check by turning this option 
off.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>blockWhenFull</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>2.9</strong></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Whether a thread that sends 
messages to a full&#160;<strong>seda</strong> queue will block until the 
queue's capacity is no longer exhausted. By default, an exception will be 
thrown stating that the queue is full. By enabling this option, the calling 
thread will instead block and wait until the message can be 
accepted.</p></td></tr><tr><td colspan=
 "1" rowspan="1" class="confluenceTd"><p><code>queueSize</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>2.9</strong></p></td><td colspan="1" 
rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Component only:</strong> the maximum size 
(capacity of the number of messages it can hold) of 
the&#160;<strong>seda</strong> queue.</p><div 
class="confluence-information-macro 
confluence-information-macro-information"><span class="aui-icon aui-icon-small 
aui-iconfont-info confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>This option is used when 
<strong><code>size</code></strong> is not 
specified.</p></div></div></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>pollTimeout</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>2.9.3</strong></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td 
col
 span="1" rowspan="1" class="confluenceTd"><p><strong>Consumer only</strong>: 
the timeout used when polling. When a timeout occurs, the consumer can check 
whether it is allowed to continue running. Setting a lower value allows the 
consumer to react more quickly upon shutdown.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>purgeWhenStopping</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>2.11.1</strong></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether to purge the task queue when 
stopping the consumer/route. This allows to stop faster, as any pending 
messages on the queue is discarded.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>queue</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>2.12.0</strong></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p>
 </td><td colspan="1" rowspan="1" class="confluenceTd"><p>Define the queue 
instance which will be used by <strong>seda</strong> 
endpoint</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>queueFactory</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>2.12.0</strong></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Define 
the&#160;<strong><code>QueueFactory</code></strong> which could create the 
queue for the <strong>seda</strong> endpoint</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>failIfNoConsumers</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>2.12.0</strong></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether the producer should fail by 
throwing an exception when sending to a&#160;<strong>seda<
 /strong> queue with no active consumers.</p><div 
class="confluence-information-macro 
confluence-information-macro-information"><span class="aui-icon aui-icon-small 
aui-iconfont-info confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Only one of the 
options&#160;<span><strong><code>discardIfNoConsumers</code></strong></span> 
and <span><strong><code>failIfNoConsumers</code></strong></span> can be enabled 
at the same time.</p></div></div></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>discardIfNoConsumers</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>2.16</strong></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether the producer should discard the 
message (do not add the message to the queue) when sending to 
a&#160;<strong>seda</strong> queue with no active 
consumers.<span>&#160;</span></p><div class=
 "confluence-information-macro confluence-information-macro-information"><span 
class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Only one of the 
options&#160;<strong><code>discardIfNoConsumers</code></strong> 
and&#160;<strong><code>failIfNoConsumers</code></strong> can be enabled at the 
same time.</p></div></div></td></tr></tbody></table></div><h3 
id="SEDA-ChoosingBlockingQueueimplementation">Choosing BlockingQueue 
implementation</h3><p><strong>Available as of Camel 2.12</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[&lt;bean id=&quot;arrayQueue&quot; 
class=&quot;java.util.ArrayBlockingQueue&quot;&gt;
-  &lt;constructor-arg index=&quot;0&quot; value=&quot;10&quot;&gt;   &lt;!-- 
size --&gt;
-  &lt;constructor-arg index=&quot;1&quot; value=&quot;true&quot;&gt; &lt;!-- 
fairness --&gt;
+<div class="wiki-content maincontent"><h2 id="SEDA-SEDAComponent">SEDA 
Component</h2><p>The <strong><code>seda:</code></strong> component provides 
asynchronous&#160;<a shape="rect" class="external-link" 
href="https://en.wikipedia.org/wiki/Staged_event-driven_architecture"; 
rel="nofollow">SEDA</a> behavior, so that messages are exchanged on a 
BlockingQueue and consumers are invoked in a separate thread from the 
producer.<a shape="rect" class="external-link" 
href="http://www.eecs.harvard.edu/~mdw/proj/seda/"; 
rel="nofollow"></a></p><p>Note that queues are only visible within a 
<em>single</em> <a shape="rect" href="camelcontext.html">CamelContext</a>. If 
you want to communicate across <strong><code>CamelContext</code></strong> 
instances (for example, communicating between Web applications), see the <a 
shape="rect" href="vm.html">VM</a> component.</p><p>This component does not 
implement any kind of persistence or recovery, if the VM terminates while 
messages are yet to be processed. If yo
 u need persistence, reliability or distributed SEDA, try using either <a 
shape="rect" href="jms.html">JMS</a> or <a shape="rect" 
href="activemq.html">ActiveMQ</a>.</p><parameter 
ac:name="title">Synchronous</parameter><rich-text-body><p>The <a shape="rect" 
href="direct.html">Direct</a> component provides synchronous invocation of any 
consumers when a producer sends a message exchange.</p></rich-text-body><h3 
id="SEDA-URIformat">URI format</h3><plain-text-body>seda:someName[?options]
+</plain-text-body><p>Where&#160;<strong><code>someName</code></strong> can be 
any string that uniquely identifies the endpoint within the current <a 
shape="rect" href="camelcontext.html">CamelContext</a>.</p><p>You can append 
query options to the URI in the following format: 
<strong><code>?option=value&amp;option=value&amp;...</code></strong></p><h3 
id="SEDA-Options">Options</h3><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Since</p></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>size</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>The maximum capacit
 y of the&#160;<strong>seda</strong> queue, i.e., the number of messages it can 
hold.</p><p>The default value in <strong>Camel 2.2</strong> or older is 
<strong><code>1000</code></strong>.</p><p>From <strong>Camel 2.3</strong>: the 
size is unbounded by 
default.</p><p>&#160;</p><rich-text-body><p><strong>Note:</strong> Care should 
be taken when using this option. The size is determined by the value specified 
<em>when the first endpoint is created</em>. Each endpoint must therefore 
specify the same size.</p><p><strong>From</strong> <strong>Camel 2.11</strong>: 
a validation is taken place to ensure if using mixed queue sizes for the same 
queue name, Camel would detect this and fail creating the 
endpoint.</p></rich-text-body></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>concurrentConsumers</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>1</code></p></td><td colspan="1" 
rowspan="1
 " class="confluenceTd"><p>Number of concurrent threads processing 
exchanges.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>waitForTaskToComplete</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>IfReplyExpected</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Option to specify whether the 
caller should wait for the asynchronous task to complete before 
continuing.</p><p>The following options are 
supported:</p><ul><li><p><strong><code>Always</code></strong></p></li><li><p><strong><code>Never</code></strong></p></li><li><p><strong><code>IfReplyExpected</code></strong></p></li></ul><p>The
 first two values are self-explanatory.</p><p>The last value, 
<strong><code>IfReplyExpected</code></strong>, will only wait if the message is 
<a shape="rect" href="request-reply.html">Request Reply</a> based.</p><p>See <a 
shape="rect" href="async.html">Async</a> messaging for
  more details.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>timeout</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>30000</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Timeout (in milliseconds) before 
a&#160;<strong>seda</strong> producer will stop waiting for an asynchronous 
task to complete.</p><p>See <strong><code>waitForTaskToComplete</code></strong> 
and <a shape="rect" href="async.html">Async</a> for more details.</p><p>From 
<strong>Camel 2.2:</strong> you can now disable timeout by 
using&#160;<strong><code>0</code></strong> or a negative 
value.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>multipleConsumers</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>2.2</strong></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="c
 onfluenceTd"><p>Specifies whether multiple consumers are allowed. If enabled, 
you can use <a shape="rect" href="seda.html">SEDA</a> for <a shape="rect" 
class="external-link" 
href="http://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern"; 
rel="nofollow">Publish-Subscribe</a> messaging. That is, you can send a message 
to the&#160;<strong>seda</strong> queue and have each consumer receive a copy 
of the message. When enabled, this option should be specified on every consumer 
endpoint.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>limitConcurrentConsumers</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>2.3</strong></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether to limit the number of 
<strong><code>concurrentConsumers</code></strong> to the maximum of 
<strong><code>500</code></strong>.</p><p>By default, an exception will be thrown
  if a&#160;<strong>seda</strong> endpoint is configured with a greater number. 
You can disable that check by turning this option off.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>blockWhenFull</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>2.9</strong></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Whether a thread that sends 
messages to a full&#160;<strong>seda</strong> queue will block until the 
queue's capacity is no longer exhausted. By default, an exception will be 
thrown stating that the queue is full. By enabling this option, the calling 
thread will instead block and wait until the message can be 
accepted.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>queueSize</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>2.9</strong></p></td><td 
colspan="1" rowspan="1" class="confluence
 Td">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Component only:</strong> the maximum size 
(capacity of the number of messages it can hold) of 
the&#160;<strong>seda</strong> queue.</p><rich-text-body><p>This option is used 
when <strong><code>size</code></strong> is not 
specified.</p></rich-text-body></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>pollTimeout</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>2.9.3</strong></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Consumer only</strong>: 
the timeout used when polling. When a timeout occurs, the consumer can check 
whether it is allowed to continue running. Setting a lower value allows the 
consumer to react more quickly upon shutdown.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>purgeWhenStopping</code></p></td><td 
colspan="1" row
 span="1" class="confluenceTd"><p><strong>2.11.1</strong></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Whether to purge the task queue 
when stopping the consumer/route. This allows to stop faster, as any pending 
messages on the queue is discarded.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>queue</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>2.12.0</strong></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Define the queue instance which 
will be used by <strong>seda</strong> endpoint</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>queueFactory</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>2.12.0</strong></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><t
 d colspan="1" rowspan="1" class="confluenceTd"><p>Define 
the&#160;<strong><code>QueueFactory</code></strong> which could create the 
queue for the <strong>seda</strong> endpoint</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>failIfNoConsumers</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>2.12.0</strong></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether the producer should fail by 
throwing an exception when sending to a&#160;<strong>seda</strong> queue with 
no active consumers.</p><rich-text-body><p>Only one of the 
options&#160;<span><strong><code>discardIfNoConsumers</code></strong></span> 
and <span><strong><code>failIfNoConsumers</code></strong></span> can be enabled 
at the same time.</p></rich-text-body></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>discardIfNoConsumers</code></p></td><td 
colspan="1" rowsp
 an="1" class="confluenceTd"><p><strong>2.16</strong></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Whether the producer should discard the 
message (do not add the message to the queue) when sending to 
a&#160;<strong>seda</strong> queue with no active 
consumers.<span>&#160;</span></p><rich-text-body><p>Only one of the 
options&#160;<strong><code>discardIfNoConsumers</code></strong> 
and&#160;<strong><code>failIfNoConsumers</code></strong> can be enabled at the 
same time.</p></rich-text-body></td></tr></tbody></table></div><h3 
id="SEDA-ChoosingBlockingQueueimplementation">Choosing BlockingQueue 
implementation</h3><p><strong>Available as of Camel 2.12</strong></p><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;bean id="arrayQueue" 
class="java.util.ArrayBlockingQueue"&gt;
+  &lt;constructor-arg index="0" value="10"&gt;   &lt;!-- size --&gt;
+  &lt;constructor-arg index="1" value="true"&gt; &lt;!-- fairness --&gt;
 &lt;/bean&gt;
 
 &lt;!-- ... --&gt;
 
-&lt;from uri=&quot;seda:array?queue=#arrayQueue&quot;/&gt;
-]]></script>
-</div></div><p>By default, the&#160;<strong>seda</strong> component 
instantiates a <strong><code>LinkedBlockingQueue</code></strong>. However, a 
different implementation can be chosen by specifying a custom&#160; 
<strong><code>BlockingQueue</code></strong> implementation. When a custom 
implementation is configured the&#160;<strong><code>size</code></strong> option 
is ignored.</p><p>The list of 
available&#160;<strong><code>BlockingQueueFactory</code></strong> 
implementations 
includes:</p><ul><li><strong><code>LinkedBlockingQueueFactory</code></strong></li><li><strong><code>ArrayBlockingQueueFactory</code></strong></li><li><strong><code>PriorityBlockingQueueFactory</code></strong><br
 clear="none"><br clear="none"></li></ul><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;priorityQueueFactory&quot; 
class=&quot;org.apache.camel.component.seda.PriorityBlockingQueueFactory&quot;&gt;
-  &lt;property name=&quot;comparator&quot;&gt;
-    &lt;bean class=&quot;org.apache.camel.demo.MyExchangeComparator&quot;/&gt;
+&lt;from uri="seda:array?queue=#arrayQueue"/&gt;
+</plain-text-body><p>By default, the&#160;<strong>seda</strong> component 
instantiates a <strong><code>LinkedBlockingQueue</code></strong>. However, a 
different implementation can be chosen by specifying a custom&#160; 
<strong><code>BlockingQueue</code></strong> implementation. When a custom 
implementation is configured the&#160;<strong><code>size</code></strong> option 
is ignored.</p><p>The list of 
available&#160;<strong><code>BlockingQueueFactory</code></strong> 
implementations 
includes:</p><ul><li><strong><code>LinkedBlockingQueueFactory</code></strong></li><li><strong><code>ArrayBlockingQueueFactory</code></strong></li><li><strong><code>PriorityBlockingQueueFactory</code></strong><br
 clear="none"><br clear="none"></li></ul><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;bean 
id="priorityQueueFactory" 
class="org.apache.camel.component.seda.PriorityBlockingQueueFactory"&gt;
+  &lt;property name="comparator"&gt;
+    &lt;bean class="org.apache.camel.demo.MyExchangeComparator"/&gt;
   &lt;/property&gt;
 &lt;/bean&gt;
 
 &lt;!-- ...and later --&gt;
 
-&lt;from 
uri=&quot;seda:priority?queueFactory=#priorityQueueFactory&amp;size=100&quot;/&gt;
-&lt;!-- ... --&gt; ]]></script>
-</div></div><h3 id="SEDA-UseofRequestReply">Use of Request Reply</h3><p>The <a 
shape="rect" href="seda.html">SEDA</a> component supports using <a shape="rect" 
href="request-reply.html">Request Reply</a>, where the caller will wait for the 
<a shape="rect" href="async.html">Async</a> route to complete. For 
instance:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;mina:tcp://0.0.0.0:9876?textline=true&amp;sync=true&quot;)
-  .to(&quot;seda:input&quot;);
-
-from(&quot;seda:input&quot;)
-  .to(&quot;bean:processInput&quot;)
-  .to(&quot;bean:createResponse&quot;);
-]]></script>
-</div></div><p>In the route above, we have a TCP listener on 
port&#160;<strong><code>9876</code></strong> that accepts incoming requests. 
The request is routed to the <strong><code>seda:input</code></strong> queue. As 
it is a <a shape="rect" href="request-reply.html">Request Reply</a> message, we 
wait for the response. When the consumer on the 
<strong><code>seda:input</code></strong> queue is complete, it copies the 
response to the original message response.</p><div 
class="confluence-information-macro confluence-information-macro-note"><p 
class="title">until 2.2: Works only with 2 endpoints</p><span class="aui-icon 
aui-icon-small aui-iconfont-warning 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Using <a shape="rect" 
href="request-reply.html">Request Reply</a> over <a shape="rect" 
href="seda.html">SEDA</a> or <a shape="rect" href="vm.html">VM</a> only works 
with 2 endpoints. You <strong>cannot</strong> chain endpoints by sending 
to&#160;
 <strong><code>A -&gt; B -&gt; C</code></strong> etc. Only between 
<strong><code>A -&gt; B</code></strong>. The reason is the implementation logic 
is fairly simple. To support 3+ endpoints makes the logic much more complex to 
handle ordering and notification between the waiting threads 
properly.</p><p>This has been improved in <strong>Camel 2.3</strong>, which 
allows you to chain as many endpoints as you like.</p></div></div><h3 
id="SEDA-Concurrentconsumers">Concurrent consumers</h3><p>By default, the SEDA 
endpoint uses a single consumer thread, but you can configure it to use 
concurrent consumer threads. So, instead of thread pools you can use:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;seda:stageName?concurrentConsumers=5&quot;)
+&lt;from 
uri="seda:priority?queueFactory=#priorityQueueFactory&amp;size=100"/&gt;
+&lt;!-- ... --&gt;&#160;</plain-text-body><h3 id="SEDA-UseofRequestReply">Use 
of Request Reply</h3><p>The <a shape="rect" href="seda.html">SEDA</a> component 
supports using <a shape="rect" href="request-reply.html">Request Reply</a>, 
where the caller will wait for the <a shape="rect" href="async.html">Async</a> 
route to complete. For instance:</p><parameter 
ac:name="language">java</parameter><plain-text-body>from("mina:tcp://0.0.0.0:9876?textline=true&amp;sync=true")
+  .to("seda:input");
+
+from("seda:input")
+  .to("bean:processInput")
+  .to("bean:createResponse");
+</plain-text-body><p>In the route above, we have a TCP listener on 
port&#160;<strong><code>9876</code></strong> that accepts incoming requests. 
The request is routed to the <strong><code>seda:input</code></strong> queue. As 
it is a <a shape="rect" href="request-reply.html">Request Reply</a> message, we 
wait for the response. When the consumer on the 
<strong><code>seda:input</code></strong> queue is complete, it copies the 
response to the original message response.</p><parameter ac:name="title">until 
2.2: Works only with 2 endpoints</parameter><rich-text-body><p>Using <a 
shape="rect" href="request-reply.html">Request Reply</a> over <a shape="rect" 
href="seda.html">SEDA</a> or <a shape="rect" href="vm.html">VM</a> only works 
with 2 endpoints. You <strong>cannot</strong> chain endpoints by sending 
to&#160;<strong><code>A -&gt; B -&gt; C</code></strong> etc. Only between 
<strong><code>A -&gt; B</code></strong>. The reason is the implementation logic 
is fairly simple. To support 3+ endpo
 ints makes the logic much more complex to handle ordering and notification 
between the waiting threads properly.</p><p>This has been improved in 
<strong>Camel 2.3</strong>, which allows you to chain as many endpoints as you 
like.</p></rich-text-body><h3 id="SEDA-Concurrentconsumers">Concurrent 
consumers</h3><p>By default, the SEDA endpoint uses a single consumer thread, 
but you can configure it to use concurrent consumer threads. So, instead of 
thread pools you can use:</p><parameter 
ac:name="language">java</parameter><plain-text-body>from("seda:stageName?concurrentConsumers=5")
   .process(...)
-]]></script>
-</div></div><p>As for the difference between the two, note a <em>thread 
pool</em> can increase/shrink dynamically at runtime depending on load, whereas 
the number of concurrent consumers is always fixed.</p><h3 
id="SEDA-Threadpools">Thread pools</h3><p>Be aware that adding a thread pool to 
a&#160;<strong>seda</strong> endpoint by doing something like:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;seda:stageName&quot;)
+</plain-text-body><p>As for the difference between the two, note a <em>thread 
pool</em> can increase/shrink dynamically at runtime depending on load, whereas 
the number of concurrent consumers is always fixed.</p><h3 
id="SEDA-Threadpools">Thread pools</h3><p>Be aware that adding a thread pool to 
a&#160;<strong>seda</strong> endpoint by doing something like:</p><parameter 
ac:name="language">java</parameter><plain-text-body>from("seda:stageName")
   .thread(5)
   .process(...)
-]]></script>
-</div></div><p>Can wind up with two <strong><code>BlockQueues</code>:</strong> 
one from the&#160;<strong>seda</strong> endpoint, and one from the workqueue of 
the thread pool, which may not be what you want. Instead, you might wish to 
configure a <a shape="rect" href="direct.html">Direct</a> endpoint with a 
thread pool, which can process messages both synchronously and asynchronously. 
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[from(&quot;direct:stageName&quot;)
+</plain-text-body><p>Can wind up with two 
<strong><code>BlockQueues</code>:</strong> one from 
the&#160;<strong>seda</strong> endpoint, and one from the workqueue of the 
thread pool, which may not be what you want. Instead, you might wish to 
configure a <a shape="rect" href="direct.html">Direct</a> endpoint with a 
thread pool, which can process messages both synchronously and asynchronously. 
For example:</p><parameter 
ac:name="language">java</parameter><plain-text-body>from("direct:stageName")
   .thread(5)
   .process(...)
-]]></script>
-</div></div><p>You can also directly configure number of threads that process 
messages on a&#160;<strong>seda</strong> endpoint using the 
<strong><code>concurrentConsumers</code></strong> option.</p><h3 
id="SEDA-Sample">Sample</h3><p>In the route below we use the SEDA queue to send 
the request to this asynchronous queue to be able to send a fire-and-forget 
message for further processing in another thread, and return a constant reply 
in this thread to the original caller.</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[
-public void configure() throws Exception {
-    from(&quot;direct:start&quot;)
-        // send it to the seda queue that is async
-        .to(&quot;seda:next&quot;)
-        // return a constant response
-        .transform(constant(&quot;OK&quot;));
-
-    from(&quot;seda:next&quot;).to(&quot;mock:result&quot;);
-}
-]]></script>
-</div></div>Here we send a Hello World message and expects the reply to be 
OK.<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[
-Object out = template.requestBody(&quot;direct:start&quot;, &quot;Hello 
World&quot;);
-assertEquals(&quot;OK&quot;, out);
-]]></script>
-</div></div>The&#160;<strong><code>Hello World</code></strong> message will be 
consumed from the&#160;<strong>seda</strong> queue from another thread for 
further processing. Since this is from a unit test, it will be sent to a 
<strong><code>mock</code></strong> endpoint where we can do assertions in the 
unit test.<h3 
id="SEDA-UsingmultipleConsumers">Using&#160;<code>multipleConsumers</code></h3><p><strong>Available
 as of Camel 2.2</strong></p><p>In this example we have defined two consumers 
and registered them as spring beans.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-&lt;!-- define the consumers as spring beans --&gt;
-&lt;bean id=&quot;consumer1&quot; 
class=&quot;org.apache.camel.spring.example.FooEventConsumer&quot;/&gt;
-
-&lt;bean id=&quot;consumer2&quot; 
class=&quot;org.apache.camel.spring.example.AnotherFooEventConsumer&quot;/&gt;
-
-&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    &lt;!-- define a shared endpoint which the consumers can refer to instead 
of using url --&gt;
-    &lt;endpoint id=&quot;foo&quot; 
uri=&quot;seda:foo?multipleConsumers=true&quot;/&gt;
-&lt;/camelContext&gt;
-]]></script>
-</div></div>Since we have specified 
<strong><code>multipleConsumers=true</code></strong> on the 
<strong>seda</strong>&#160;<strong><code>foo</code></strong> endpoint we can 
have those two consumers receive their own copy of the message as a kind of 
pub-sub style messaging.<p>As the beans are part of an unit test they simply 
send the message to a&#160;<strong><code>mock</code></strong> endpoint. Note 
the use of <strong><code>@Consume</code></strong> to consume from the 
<strong>seda</strong> queue.</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[
-public class FooEventConsumer {
-
-    @EndpointInject(uri = &quot;mock:result&quot;)
-    private ProducerTemplate destination;
-
-    @Consume(ref = &quot;foo&quot;)
-    public void doSomething(String body) {
-        destination.sendBody(&quot;foo&quot; + body);
-    }
-
-}
-]]></script>
-</div></div><h3 id="SEDA-ExtractingQueueInformation.">Extracting Queue 
Information.</h3><p>If needed, information such as queue size, etc. can be 
obtained without using JMX in this fashion:</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[SedaEndpoint seda = 
context.getEndpoint(&quot;seda:xxxx&quot;);
+</plain-text-body><p>You can also directly configure number of threads that 
process messages on a&#160;<strong>seda</strong> endpoint using the 
<strong><code>concurrentConsumers</code></strong> option.</p><h3 
id="SEDA-Sample">Sample</h3><p>In the route below we use the SEDA queue to send 
the request to this asynchronous queue to be able to send a fire-and-forget 
message for further processing in another thread, and return a constant reply 
in this thread to the original caller.<parameter 
ac:name="atlassian-macro-output-type">INLINE</parameter><plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/component/seda/SedaAsyncRouteTest.java}</plain-text-body>Here
 we send a Hello World message and expects the reply to be OK.<parameter 
ac:name="atlassian-macro-output-type">INLINE</parameter><plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/component/seda/SedaAsyncRouteTest.java}</plain-text-body>Th
 e&#160;<strong><code>Hello World</code></strong> message will be consumed from 
the&#160;<strong>seda</strong> queue from another thread for further 
processing. Since this is from a unit test, it will be sent to a 
<strong><code>mock</code></strong> endpoint where we can do assertions in the 
unit test.</p><h3 
id="SEDA-UsingmultipleConsumers">Using&#160;<code>multipleConsumers</code></h3><p><strong>Available
 as of Camel 2.2</strong></p><p>In this example we have defined two consumers 
and registered them as spring beans.<parameter 
ac:name="atlassian-macro-output-type">INLINE</parameter><plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/fooEventRoute.xml}</plain-text-body>Since
 we have specified <strong><code>multipleConsumers=true</code></strong> on the 
<strong>seda</strong>&#160;<strong><code>foo</code></strong> endpoint we can 
have those two consumers receive their own copy of the message as a kind of pub
 -sub style messaging.</p><p>As the beans are part of an unit test they simply 
send the message to a&#160;<strong><code>mock</code></strong> endpoint. Note 
the use of <strong><code>@Consume</code></strong> to consume from the 
<strong>seda</strong> queue.<parameter 
ac:name="atlassian-macro-output-type">INLINE</parameter><plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/FooEventConsumer.java}</plain-text-body></p><h3
 id="SEDA-ExtractingQueueInformation.">Extracting Queue Information.</h3><p>If 
needed, information such as queue size, etc. can be obtained without using JMX 
in this fashion:</p><parameter 
ac:name="language">java</parameter><plain-text-body>SedaEndpoint seda = 
context.getEndpoint("seda:xxxx");
 int size = seda.getExchanges().size();
-]]></script>
-</div></div><p></p><h3 id="SEDA-SeeAlso">See Also</h3>
-<ul><li><a shape="rect" href="configuring-camel.html">Configuring 
Camel</a></li><li><a shape="rect" 
href="component.html">Component</a></li><li><a shape="rect" 
href="endpoint.html">Endpoint</a></li><li><a shape="rect" 
href="getting-started.html">Getting Started</a></li></ul><ul 
class="alternate"><li><a shape="rect" href="vm.html">VM</a></li><li><a 
shape="rect" href="disruptor.html">Disruptor</a></li><li><a shape="rect" 
href="direct.html">Direct</a></li><li><a shape="rect" 
href="async.html">Async</a></li></ul></div>
+</plain-text-body><p><parameter ac:name=""><a shape="rect" 
href="endpoint-see-also.html">Endpoint See Also</a></parameter></p><ul 
class="alternate"><li><a shape="rect" href="vm.html">VM</a></li><li><a 
shape="rect" href="disruptor.html">Disruptor</a></li><li><a shape="rect" 
href="direct.html">Direct</a></li><li><a shape="rect" 
href="async.html">Async</a></li></ul></div>
         </td>
         <td valign="top">
           <div class="navigation">

Modified: websites/production/camel/content/spring.html
==============================================================================
--- websites/production/camel/content/spring.html (original)
+++ websites/production/camel/content/spring.html Fri Aug 25 10:20:13 2017
@@ -36,17 +36,6 @@
     <![endif]-->
 
 
-  <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css' 
rel='stylesheet' type='text/css' />
-  <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' 
rel='stylesheet' type='text/css' />
-  <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' 
type='text/javascript'></script>
-  
-  <script type="text/javascript">
-  SyntaxHighlighter.defaults['toolbar'] = false;
-  SyntaxHighlighter.all();
-  </script>
 
     <title>
     Apache Camel: Spring
@@ -86,152 +75,68 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="Spring-SpringSupport">Spring 
Support</h2><p>Apache Camel is designed to work nicely with the <a shape="rect" 
class="external-link" href="http://www.springframework.org/"; 
rel="nofollow">Spring Framework</a> in a number of ways.</p><ul><li>Camel uses 
Spring Transactions as the default transaction handling in components like <a 
shape="rect" href="jms.html">JMS</a> and <a shape="rect" 
href="jpa.html">JPA</a></li><li>Camel works with Spring 2 XML processing with 
the <a shape="rect" href="xml-configuration.html">Xml 
Configuration</a></li><li>Camel Spring XML Schema's is defined at <a 
shape="rect" href="xml-reference.html">Xml Reference</a></li><li>Camel supports 
a powerful version of <a shape="rect" href="spring-remoting.html">Spring 
Remoting</a> which can use powerful routing between the client and server side 
along with using all of the available <a shape="rect" 
href="components.html">Components</a> for the transport</li><li>Camel provides p
 owerful <a shape="rect" href="bean-integration.html">Bean Integration</a> with 
any bean defined in a Spring 
<strong><code>ApplicationContext</code></strong>.</li><li>Camel integrates with 
various Spring helper classes; such as providing <a shape="rect" 
href="type-converter.html">Type Converter</a> support for Spring Resources 
etc</li><li>Allows Spring to dependency inject <a shape="rect" 
href="component.html">Component</a> instances or the <a shape="rect" 
href="camelcontext.html">CamelContext</a> instance itself and auto-expose 
Spring beans as components and endpoints.</li><li>Allows you to reuse the <a 
shape="rect" href="spring-testing.html">Spring Testing</a> framework to 
simplify your unit and integration testing using <a shape="rect" 
href="enterprise-integration-patterns.html">Enterprise Integration Patterns</a> 
and Camel's powerful <a shape="rect" href="mock.html">Mock</a> and <a 
shape="rect" href="test.html">Test</a> 
endpoints</li><li>From&#160;<strong>Camel 2.15</strong>: Cam
 el supports Spring Boot using the&#160;<code><a shape="rect" 
href="spring-boot.html">camel-spring-boot</a></code> 
component.</li><li>From&#160;<strong>Camel 2.17.1</strong>: Camel supports 
Spring Cache based Idempotent repository</li></ul><h2 
id="Spring-UsingSpringtoconfiguretheCamelContext">Using Spring to configure the 
CamelContext</h2><p>You can configure 
a&#160;<strong><code>CamelContext</code></strong> inside 
any&#160;<strong><code>spring.xml</code></strong> using the <a shape="rect" 
class="external-link" 
href="http://camel.apache.org/maven/current/camel-spring/apidocs/org/apache/camel/spring/CamelContextFactoryBean.html";>CamelContextFactoryBean</a>.
 This will automatically <a shape="rect" href="lifecycle.html">start</a> the <a 
shape="rect" href="camelcontext.html">CamelContext</a> along with any 
referenced <a shape="rect" href="routes.html">Routes</a> along any referenced 
<a shape="rect" href="component.html">Component</a> and <a shape="rect" 
href="endpoint.html">Endpoint</a> 
 instances.</p><ul><li>Adding Camel schema</li><li>Configure <a shape="rect" 
href="routes.html">Routes</a> in two ways:<ul><li>Using Java Code</li><li>Using 
Spring XML</li></ul></li></ul><h3 id="Spring-AddingCamelSchema">Adding Camel 
Schema</h3><div class="confluence-information-macro 
confluence-information-macro-note"><span class="aui-icon aui-icon-small 
aui-iconfont-warning confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>For Camel 1.x you need to use the 
following namespace:</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[http://activemq.apache.org/camel/schema/spring
-]]></script>
-</div></div><p>with the following schema location:</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[http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
-]]></script>
-</div></div></div></div><p>You need to add Camel to the 
<strong><code>schemaLocation</code></strong> declaration</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[http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
-]]></script>
-</div></div><p>So the XML file looks like this:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;beans 
xmlns=&quot;http://www.springframework.org/schema/beans&quot;
-       xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
-       xsi:schemaLocation=&quot;
+<div class="wiki-content maincontent"><h2 id="Spring-SpringSupport">Spring 
Support</h2><p>Apache Camel is designed to work nicely with the <a shape="rect" 
class="external-link" href="http://www.springframework.org/"; 
rel="nofollow">Spring Framework</a> in a number of ways.</p><ul><li>Camel uses 
Spring Transactions as the default transaction handling in components like <a 
shape="rect" href="jms.html">JMS</a> and <a shape="rect" 
href="jpa.html">JPA</a></li><li>Camel works with Spring 2 XML processing with 
the <a shape="rect" href="xml-configuration.html">Xml 
Configuration</a></li><li>Camel Spring XML Schema's is defined at <a 
shape="rect" href="xml-reference.html">Xml Reference</a></li><li>Camel supports 
a powerful version of <a shape="rect" href="spring-remoting.html">Spring 
Remoting</a> which can use powerful routing between the client and server side 
along with using all of the available <a shape="rect" 
href="components.html">Components</a> for the transport</li><li>Camel provides p
 owerful <a shape="rect" href="bean-integration.html">Bean Integration</a> with 
any bean defined in a Spring 
<strong><code>ApplicationContext</code></strong>.</li><li>Camel integrates with 
various Spring helper classes; such as providing <a shape="rect" 
href="type-converter.html">Type Converter</a> support for Spring Resources 
etc</li><li>Allows Spring to dependency inject <a shape="rect" 
href="component.html">Component</a> instances or the <a shape="rect" 
href="camelcontext.html">CamelContext</a> instance itself and auto-expose 
Spring beans as components and endpoints.</li><li>Allows you to reuse the <a 
shape="rect" href="spring-testing.html">Spring Testing</a> framework to 
simplify your unit and integration testing using <a shape="rect" 
href="enterprise-integration-patterns.html">Enterprise Integration Patterns</a> 
and Camel's powerful <a shape="rect" href="mock.html">Mock</a> and <a 
shape="rect" href="test.html">Test</a> 
endpoints</li><li>From&#160;<strong>Camel 2.15</strong>: Cam
 el supports Spring Boot using the&#160;<code><a shape="rect" 
href="spring-boot.html">camel-spring-boot</a></code> 
component.</li><li>From&#160;<strong>Camel 2.17.1</strong>: Camel supports 
Spring Cache based Idempotent repository</li></ul><h2 
id="Spring-UsingSpringtoconfiguretheCamelContext">Using Spring to configure the 
CamelContext</h2><p>You can configure 
a&#160;<strong><code>CamelContext</code></strong> inside 
any&#160;<strong><code>spring.xml</code></strong> using the <a shape="rect" 
class="external-link" 
href="http://camel.apache.org/maven/current/camel-spring/apidocs/org/apache/camel/spring/CamelContextFactoryBean.html";>CamelContextFactoryBean</a>.
 This will automatically <a shape="rect" href="lifecycle.html">start</a> the <a 
shape="rect" href="camelcontext.html">CamelContext</a> along with any 
referenced <a shape="rect" href="routes.html">Routes</a> along any referenced 
<a shape="rect" href="component.html">Component</a> and <a shape="rect" 
href="endpoint.html">Endpoint</a> 
 instances.</p><ul><li>Adding Camel schema</li><li>Configure <a shape="rect" 
href="routes.html">Routes</a> in two ways:<ul><li>Using Java Code</li><li>Using 
Spring XML</li></ul></li></ul><h3 id="Spring-AddingCamelSchema">Adding Camel 
Schema</h3><rich-text-body><p>For Camel 1.x you need to use the following 
namespace:</p><plain-text-body>http://activemq.apache.org/camel/schema/spring
+</plain-text-body><p>with the following schema 
location:</p><plain-text-body>http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+</plain-text-body></rich-text-body><p>You need to add Camel to the 
<strong><code>schemaLocation</code></strong> 
declaration</p><plain-text-body>http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
+</plain-text-body><p>So the XML file looks like this:</p><parameter 
ac:name="">xml</parameter><plain-text-body>&lt;beans 
xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="
           http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
-          http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd&quot;&gt;
-]]></script>
-</div></div><h4 
id="Spring-Usingcamel:Namespace">Using&#160;<code>camel:</code> 
Namespace</h4><p>Or you can refer to the camel XSD in the XML 
declaration:</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[xmlns:camel=&quot;http://camel.apache.org/schema/spring&quot;
-]]></script>
-</div></div><p>... so the declaration is:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
-       xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
-       xmlns:camel=&quot;http://camel.apache.org/schema/spring&quot;
-       xsi:schemaLocation=&quot;
-          http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
-          http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd&quot;&gt;
-]]></script>
-</div></div>... and then use the&#160;<strong><code>camel:</code></strong> 
namespace prefix, and you can omit the inline namespace declaration:<div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-&lt;camel:camelContext id=&quot;camel5&quot;&gt;
-  &lt;camel:package&gt;org.apache.camel.spring.example&lt;/camel:package&gt;
-&lt;/camel:camelContext&gt;
-]]></script>
-</div></div><h4 id="Spring-AdvancedConfigurationUsingSpring">Advanced 
Configuration Using Spring</h4><p>See more details at <a shape="rect" 
href="advanced-configuration-of-camelcontext-using-spring.html">Advanced 
configuration of CamelContext using Spring</a></p><h3 
id="Spring-UsingJavaCode">Using Java Code</h3><p>You can use Java Code to 
define your <a shape="rect" href="routebuilder.html">RouteBuilder</a> 
implementations. These can be defined as beans in spring and then referenced in 
your camel context e.g.</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-  &lt;camelContext id=&quot;camel5&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    &lt;routeBuilder ref=&quot;myBuilder&quot; /&gt;    
-  &lt;/camelContext&gt;
-  
-  &lt;bean id=&quot;myBuilder&quot; 
class=&quot;org.apache.camel.spring.example.test1.MyRouteBuilder&quot;/&gt;
-  
-&lt;/beans&gt;
-]]></script>
-</div></div><h4 
id="Spring-Using&lt;package&gt;">Using&#160;<code>&lt;package&gt;</code></h4><p>Camel
 also provides a powerful feature that allows for the automatic discovery and 
initialization of routes in given packages. This is configured by adding tags 
to the camel context in your spring context definition, specifying the packages 
to be recursively searched for <a shape="rect" 
href="routebuilder.html">RouteBuilder</a> implementations. To use this feature 
in <strong><code>1.X</code></strong>, requires 
a&#160;<strong><code>&lt;package&gt;&lt;/package&gt;</code></strong> tag 
specifying a comma separated list of packages that should be searched 
e.g.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;camelContext 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
+          http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd"&gt;
+</plain-text-body><h4 
id="Spring-Usingcamel:Namespace">Using&#160;<code>camel:</code> 
Namespace</h4><p>Or you can refer to the camel XSD in the XML 
declaration:</p><plain-text-body>xmlns:camel="http://camel.apache.org/schema/spring";
+</plain-text-body><p>... so the declaration 
is:<plain-text-body>{snippet:id=xsdlocation|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBean.xml}</plain-text-body>...
 and then use the&#160;<strong><code>camel:</code></strong> namespace prefix, 
and you can omit the inline namespace 
declaration:<plain-text-body>{snippet:id=example5|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBean.xml}</plain-text-body></p><h4
 id="Spring-AdvancedConfigurationUsingSpring">Advanced Configuration Using 
Spring</h4><p>See more details at <a shape="rect" 
href="advanced-configuration-of-camelcontext-using-spring.html">Advanced 
configuration of CamelContext using Spring</a></p><h3 
id="Spring-UsingJavaCode">Using Java Code</h3><p>You can use Java Code to 
define your <a shape="rect" href="routebuilder.html">RouteBuilder</a> 
implementations. These can be defined as beans in spring and 
 then referenced in your camel context 
e.g.<plain-text-body>{snippet:id=example5|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextRouteBuilderRef.xml}</plain-text-body></p><h4
 
id="Spring-Using&lt;package&gt;">Using&#160;<code>&lt;package&gt;</code></h4><p>Camel
 also provides a powerful feature that allows for the automatic discovery and 
initialization of routes in given packages. This is configured by adding tags 
to the camel context in your spring context definition, specifying the packages 
to be recursively searched for <a shape="rect" 
href="routebuilder.html">RouteBuilder</a> implementations. To use this feature 
in <strong><code>1.X</code></strong>, requires 
a&#160;<strong><code>&lt;package&gt;&lt;/package&gt;</code></strong> tag 
specifying a comma separated list of packages that should be searched 
e.g.</p><parameter ac:name="">xml</parameter><plain-text-body>  
&lt;camelContext xmlns="http://camel.apache.org/schema/spring"&gt;
     &lt;package&gt;org.apache.camel.spring.config.scan.route&lt;/package&gt;
   &lt;/camelContext&gt;
-]]></script>
-</div></div><div class="confluence-information-macro 
confluence-information-macro-warning"><span class="aui-icon aui-icon-small 
aui-iconfont-error confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Use caution when specifying the 
package name as <strong><code>org.apache.camel</code></strong> or a sub package 
of this. This causes Camel to search in its own packages for your routes which 
could cause problems.</p></div></div><div class="confluence-information-macro 
confluence-information-macro-information"><p class="title">Will ignore already 
instantiated classes</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>The&#160;<strong><code>&lt;package&gt;</code></strong>
 and&#160;<strong><code>&lt;packageScan&gt;</code></strong> will skip any 
classes which has already been created by Spring etc. So if you define a route 
builder as a spring bean tag the
 n that class will be skipped. You can include those beans using 
<strong><code>&lt;routeBuilder ref="theBeanId"/&gt;</code></strong> or the 
<strong><code>&lt;contextScan&gt;</code></strong> feature.</p></div></div><h4 
id="Spring-Using&lt;packageScan&gt;">Using&#160;<code>&lt;packageScan&gt;</code></h4><p>In
 Camel 2.0 this has been extended to allow selective inclusion and exclusion of 
discovered route classes using Ant like path matching. In spring this is 
specified by adding a&#160;<strong><code>&lt;packageScan/&gt;</code></strong> 
tag. The tag must contain one or 
more&#160;<strong><code>package</code></strong> elements (similar to 
<strong><code>1.x</code></strong>), and optionally one or 
more&#160;<strong><code>includes</code></strong> 
or&#160;<strong><code>excludes</code></strong> elements specifying patterns to 
be applied to the fully qualified names of the discovered classes. 
e.g.,</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl
 ">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;camelContext 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
+</plain-text-body><rich-text-body><p>Use caution when specifying the package 
name as <strong><code>org.apache.camel</code></strong> or a sub package of 
this. This causes Camel to search in its own packages for your routes which 
could cause problems.</p></rich-text-body><parameter ac:name="title">Will 
ignore already instantiated 
classes</parameter><rich-text-body><p>The&#160;<strong><code>&lt;package&gt;</code></strong>
 and&#160;<strong><code>&lt;packageScan&gt;</code></strong> will skip any 
classes which has already been created by Spring etc. So if you define a route 
builder as a spring bean tag then that class will be skipped. You can include 
those beans using <strong><code>&lt;routeBuilder 
ref="theBeanId"/&gt;</code></strong> or the 
<strong><code>&lt;contextScan&gt;</code></strong> 
feature.</p></rich-text-body><h4 
id="Spring-Using&lt;packageScan&gt;">Using&#160;<code>&lt;packageScan&gt;</code></h4><p>In
 Camel 2.0 this has been extended to allow selective inclusion and exclusion o
 f discovered route classes using Ant like path matching. In spring this is 
specified by adding a&#160;<strong><code>&lt;packageScan/&gt;</code></strong> 
tag. The tag must contain one or 
more&#160;<strong><code>package</code></strong> elements (similar to 
<strong><code>1.x</code></strong>), and optionally one or 
more&#160;<strong><code>includes</code></strong> 
or&#160;<strong><code>excludes</code></strong> elements specifying patterns to 
be applied to the fully qualified names of the discovered classes. 
e.g.,</p><parameter ac:name="">xml</parameter><plain-text-body>  
&lt;camelContext xmlns="http://camel.apache.org/schema/spring"&gt;
     &lt;packageScan&gt;
       &lt;package&gt;org.example.routes&lt;/package&gt;
       &lt;excludes&gt;**.*Excluded*&lt;/excludes&gt;
       &lt;includes&gt;**.*&lt;/includes&gt;
     &lt;/packageScan&gt;
   &lt;/camelContext&gt;
-]]></script>
-</div></div><p>Exclude patterns are applied before the include patterns. If no 
include or exclude patterns are defined then all the Route classes discovered 
in the packages will be returned.</p><p>In the above example, camel will scan 
all the&#160;<strong><code>org.example.routes</code></strong> package and any 
subpackages for&#160;<strong><code>RouteBuilder</code></strong> classes. Say 
the scan finds two <strong><code>RouteBuilders</code></strong>, one 
in&#160;<strong><code>org.example.routes</code></strong> 
called&#160;<strong><code>MyRoute</code></strong> and 
another&#160;<strong><code>MyExcludedRoute</code></strong> in a subpackage 
<strong><code>excluded</code></strong>. The fully qualified names of each of 
the classes are extracted 
(<strong><code>org.example.routes.MyRoute</code></strong>,&#160;<strong><code>org.example.routes.excluded.MyExcludedRoute</code></strong>
 ) and the include and exclude patterns are applied.</p><p>The exclude 
pattern&#160;<strong><code>**.*Excluded*</
 code></strong> is going to match the FQCN 
<strong><code>org.example.routes.excluded.MyExcludedRoute</code></strong> and 
veto camel from initializing it.</p><p>Under the covers, this is using Spring's 
<a shape="rect" class="external-link" 
href="http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/util/AntPathMatcher.html";
 rel="nofollow">AntPatternMatcher</a> implementation, which matches as 
follows</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[? matches one character
+</plain-text-body><p>Exclude patterns are applied before the include patterns. 
If no include or exclude patterns are defined then all the Route classes 
discovered in the packages will be returned.</p><p>In the above example, camel 
will scan all the&#160;<strong><code>org.example.routes</code></strong> package 
and any subpackages for&#160;<strong><code>RouteBuilder</code></strong> 
classes. Say the scan finds two <strong><code>RouteBuilders</code></strong>, 
one in&#160;<strong><code>org.example.routes</code></strong> 
called&#160;<strong><code>MyRoute</code></strong> and 
another&#160;<strong><code>MyExcludedRoute</code></strong> in a subpackage 
<strong><code>excluded</code></strong>. The fully qualified names of each of 
the classes are extracted 
(<strong><code>org.example.routes.MyRoute</code></strong>,&#160;<strong><code>org.example.routes.excluded.MyExcludedRoute</code></strong>
 ) and the include and exclude patterns are applied.</p><p>The exclude 
pattern&#160;<strong><code>**.*Exclu
 ded*</code></strong> is going to match the FQCN 
<strong><code>org.example.routes.excluded.MyExcludedRoute</code></strong> and 
veto camel from initializing it.</p><p>Under the covers, this is using Spring's 
<a shape="rect" class="external-link" 
href="http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/util/AntPathMatcher.html";
 rel="nofollow">AntPatternMatcher</a> implementation, which matches as 
follows</p><plain-text-body>? matches one character
 * matches zero or more characters
 ** matches zero or more segments of a fully qualified name
-]]></script>
-</div></div><p>For example:</p><p><strong><code>**.*Excluded*</code></strong> 
would match 
<strong><code>org.simple.Excluded</code></strong>,&#160;<strong><code>org.apache.camel.SomeExcludedRoute</code></strong>
 or 
<strong><code>org.example.RouteWhichIsExcluded</code></strong>.</p><p><strong><code>**.??cluded*</code></strong>
 would match 
<strong><code>org.simple.IncludedRoute</code></strong>,&#160;<strong><code>org.simple.Excluded</code></strong>
 but <em>not</em> match 
<strong><code>org.simple.PrecludedRoute</code></strong>.</p><h4 
id="Spring-UsingcontextScan">Using&#160;<code>contextScan</code></h4><p><strong>Available
 as of Camel 2.4</strong></p><p>You can allow Camel to scan the container 
context, e.g. the Spring <strong><code>ApplicationContext</code></strong> for 
route builder instances. This allow you to use the Spring 
<strong><code>&lt;component-scan&gt;</code></strong> feature and have Camel 
pickup any&#160;<strong><code>RouteBuilder</code></strong> instances which was 
create
 d by Spring in its scan process.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-&lt;!-- enable Spring @Component scan --&gt;
-&lt;context:component-scan 
base-package=&quot;org.apache.camel.spring.issues.contextscan&quot;/&gt;
-
-&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    &lt;!-- and then let Camel use those @Component scanned route builders 
--&gt;
-    &lt;contextScan/&gt;
-&lt;/camelContext&gt;
-]]></script>
-</div></div>This allows you to just annotate your routes using the Spring 
<strong><code>@Component</code></strong> and have those routes included by 
Camel:<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[@Component
+</plain-text-body><p>For 
example:</p><p><strong><code>**.*Excluded*</code></strong> would match 
<strong><code>org.simple.Excluded</code></strong>,&#160;<strong><code>org.apache.camel.SomeExcludedRoute</code></strong>
 or 
<strong><code>org.example.RouteWhichIsExcluded</code></strong>.</p><p><strong><code>**.??cluded*</code></strong>
 would match 
<strong><code>org.simple.IncludedRoute</code></strong>,&#160;<strong><code>org.simple.Excluded</code></strong>
 but <em>not</em> match 
<strong><code>org.simple.PrecludedRoute</code></strong>.</p><h4 
id="Spring-UsingcontextScan">Using&#160;<code>contextScan</code></h4><p><strong>Available
 as of Camel 2.4</strong></p><p>You can allow Camel to scan the container 
context, e.g. the Spring <strong><code>ApplicationContext</code></strong> for 
route builder instances. This allow you to use the Spring 
<strong><code>&lt;component-scan&gt;</code></strong> feature and have Camel 
pickup any&#160;<strong><code>RouteBuilder</code></strong> instances which was 
 created by Spring in its scan 
process.<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/contextscan/SpringRouteIsComponentAnnotatedTest.xml}</plain-text-body>This
 allows you to just annotate your routes using the Spring 
<strong><code>@Component</code></strong> and have those routes included by 
Camel:</p><plain-text-body>@Component
 public class MyRoute extends SpringRouteBuilder {
 
     @Override
     public void configure() throws Exception {
-        from(&quot;direct:start&quot;)
-          .to(&quot;mock:result&quot;);
+        from("direct:start")
+          .to("mock:result");
     }
 }
-]]></script>
-</div></div><p>You can also use the ANT style for inclusion and exclusion, as 
mentioned above in the <strong><code>&lt;packageScan&gt;</code></strong> 
documentation.</p><p></p><div class="error"><span class="error">Unable to 
render {include}</span> The included page could not be found.</div><h4 
id="Spring-TestTimeExclusion.">Test Time Exclusion.</h4><p>At test time it is 
often desirable to be able to selectively exclude matching routes from being 
initialized that are not applicable or useful to the test scenario. For 
instance you might a spring context 
file&#160;<strong><code>routes-context.xml</code></strong> and three Route 
builders <strong><code>RouteA</code>,&#160;</strong><code>RouteB</code> 
and&#160;<strong><code>RouteC</code></strong> in 
the&#160;<strong><code>org.example.routes</code></strong> package. 
The&#160;<strong><code>packageScan</code></strong> definition would discover 
all three of these routes and initialize 
them.</p><p>Say&#160;<strong><code>RouteC</code></strong>
  is not applicable to our test scenario and generates a lot of noise during 
test. It would be nice to be able to exclude this route from this specific 
test. The&#160;<strong><code>SpringTestSupport</code></strong> class has been 
modified to allow this. It provides two methods 
(<strong><code>excludedRoute</code></strong> and 
<strong><code>excludedRoutes</code></strong>) that may be overridden to exclude 
a single class or an array of classes.</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[public class RouteAandRouteBOnlyTest extends 
SpringTestSupport {
+</plain-text-body><p>You can also use the ANT style for inclusion and 
exclusion, as mentioned above in the 
<strong><code>&lt;packageScan&gt;</code></strong> 
documentation.</p><p><parameter ac:name=""><a shape="rect" class="unresolved" 
href="#">how do i import routes from other xml files</a></parameter></p><h4 
id="Spring-TestTimeExclusion.">Test Time Exclusion.</h4><p>At test time it is 
often desirable to be able to selectively exclude matching routes from being 
initialized that are not applicable or useful to the test scenario. For 
instance you might a spring context 
file&#160;<strong><code>routes-context.xml</code></strong> and three Route 
builders <strong><code>RouteA</code>,&#160;</strong><code>RouteB</code> 
and&#160;<strong><code>RouteC</code></strong> in 
the&#160;<strong><code>org.example.routes</code></strong> package. 
The&#160;<strong><code>packageScan</code></strong> definition would discover 
all three of these routes and initialize 
them.</p><p>Say&#160;<strong><code>RouteC<
 /code></strong> is not applicable to our test scenario and generates a lot of 
noise during test. It would be nice to be able to exclude this route from this 
specific test. The&#160;<strong><code>SpringTestSupport</code></strong> class 
has been modified to allow this. It provides two methods 
(<strong><code>excludedRoute</code></strong> and 
<strong><code>excludedRoutes</code></strong>) that may be overridden to exclude 
a single class or an array of classes.</p><parameter 
ac:name="">java</parameter><plain-text-body>public class 
RouteAandRouteBOnlyTest extends SpringTestSupport {
     @Override      
     protected Class excludeRoute() {
         return RouteC.class;
     }
 }
-]]></script>
-</div></div><p>In order to hook into 
the&#160;<strong><code>camelContext</code></strong> initialization by spring to 
exclude the&#160;<strong><code>MyExcludedRouteBuilder.class</code></strong> we 
need to intercept the spring context creation. When 
overriding&#160;<strong><code>createApplicationContext</code></strong> to 
create the spring context, we call 
the&#160;<strong><code>getRouteExcludingApplicationContext()</code></strong> 
method to provide a special parent spring context that takes care of the 
exclusion.</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[@Override
+</plain-text-body><p>In order to hook into 
the&#160;<strong><code>camelContext</code></strong> initialization by spring to 
exclude the&#160;<strong><code>MyExcludedRouteBuilder.class</code></strong> we 
need to intercept the spring context creation. When 
overriding&#160;<strong><code>createApplicationContext</code></strong> to 
create the spring context, we call 
the&#160;<strong><code>getRouteExcludingApplicationContext()</code></strong> 
method to provide a special parent spring context that takes care of the 
exclusion.</p><parameter ac:name="">java</parameter><plain-text-body>@Override
 protected AbstractXmlApplicationContext createApplicationContext() {
-    return new ClassPathXmlApplicationContext(new String[] 
{&quot;routes-context.xml&quot;}, getRouteExcludingApplicationContext());
+    return new ClassPathXmlApplicationContext(new String[] 
{"routes-context.xml"}, getRouteExcludingApplicationContext());
 }
-]]></script>
-</div></div><p><strong><code>RouteC</code></strong> will now be excluded from 
initialization. Similarly, in another test that is testing only 
<strong><code>RouteC</code></strong>, we could 
exclude&#160;<strong><code>RouteB</code></strong> 
and&#160;<strong><code>RouteA</code></strong> by overriding:</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[@Override
+</plain-text-body><p><strong><code>RouteC</code></strong> will now be excluded 
from initialization. Similarly, in another test that is testing only 
<strong><code>RouteC</code></strong>, we could 
exclude&#160;<strong><code>RouteB</code></strong> 
and&#160;<strong><code>RouteA</code></strong> by 
overriding:</p><plain-text-body>@Override
 protected Class[] excludeRoutes() {
     return new Class[]{RouteA.class, RouteB.class};
 }
-]]></script>
-</div></div><h3 id="Spring-UsingSpringXML">Using Spring XML</h3><p>You can use 
Spring 2.0 XML configuration to specify your <a shape="rect" 
href="xml-configuration.html">Xml Configuration</a> for <a shape="rect" 
href="routes.html">Routes</a> such as in the following <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactory.xml";>example</a>.</p><div
 class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-&lt;camelContext id=&quot;camel-A&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-  &lt;route&gt;
-    &lt;from uri=&quot;seda:start&quot;/&gt;
-    &lt;to uri=&quot;mock:result&quot;/&gt;
-  &lt;/route&gt;
-&lt;/camelContext&gt;
-]]></script>
-</div></div><h2 id="Spring-ConfiguringComponentsandEndpoints">Configuring 
Components and Endpoints</h2><p>You can configure your <a shape="rect" 
href="component.html">Component</a> or <a shape="rect" 
href="endpoint.html">Endpoint</a> instances in your <a shape="rect" 
href="spring.html">Spring</a> XML as follows in <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/jmsRouteUsingSpring.xml";>this
 example</a>.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-&lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    &lt;jmxAgent id=&quot;agent&quot; disabled=&quot;true&quot;/&gt;
-&lt;/camelContext&gt;
-
-&lt;bean id=&quot;activemq&quot; 
class=&quot;org.apache.activemq.camel.component.ActiveMQComponent&quot;&gt;
-  &lt;property name=&quot;connectionFactory&quot;&gt;
-    &lt;bean 
class=&quot;org.apache.activemq.ActiveMQConnectionFactory&quot;&gt;
-      &lt;property name=&quot;brokerURL&quot; 
value=&quot;vm://localhost?broker.persistent=false&amp;amp;broker.useJmx=false&quot;/&gt;
-    &lt;/bean&gt;
-  &lt;/property&gt;
-&lt;/bean&gt;
-]]></script>
-</div></div>Which allows you to configure a component using some name 
(<strong><code>activemq</code></strong> in the above example), then you can 
refer to the component using 
<strong><code>activemq:[queue:|topic:]destinationName</code></strong>. This 
works by the&#160;<strong><code>SpringCamelContext</code></strong> lazily 
fetching components from the spring context for the scheme name you use for <a 
shape="rect" href="endpoint.html">Endpoint</a> <a shape="rect" 
href="uris.html">URIs</a>.<p>For more detail see <a shape="rect" 
href="how-do-i-configure-endpoints.html">Configuring Endpoints and 
Components</a>.</p><h2 id="Spring-SpringCacheIdempotentRepository">Spring Cache 
Idempotent Repository</h2><p>Available as of <strong>Camel 
2.17.1</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[&lt;bean id=&quot;repo&quot; 
class=&quot;org.apache.camel.spring.processor.idempotent.SpringCacheIdempotentRepository&quot;&gt;
+</plain-text-body><h3 id="Spring-UsingSpringXML">Using Spring XML</h3><p>You 
can use Spring 2.0 XML configuration to specify your <a shape="rect" 
href="xml-configuration.html">Xml Configuration</a> for <a shape="rect" 
href="routes.html">Routes</a> such as in the following <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactory.xml";>example</a>.<plain-text-body>{snippet:id=example|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactory.xml}</plain-text-body></p><h2
 id="Spring-ConfiguringComponentsandEndpoints">Configuring Components and 
Endpoints</h2><p>You can configure your <a shape="rect" 
href="component.html">Component</a> or <a shape="rect" 
href="endpoint.html">Endpoint</a> instances in your <a shape="rect" 
href="spring.html">Spring</a> XML as follows in <a shape="rect" class="extern
 al-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/jmsRouteUsingSpring.xml";>this
 
example</a>.<plain-text-body>{snippet:id=example|lang=xml|url=camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/jmsRouteUsingSpring.xml}</plain-text-body>Which
 allows you to configure a component using some name 
(<strong><code>activemq</code></strong> in the above example), then you can 
refer to the component using 
<strong><code>activemq:[queue:|topic:]destinationName</code></strong>. This 
works by the&#160;<strong><code>SpringCamelContext</code></strong> lazily 
fetching components from the spring context for the scheme name you use for <a 
shape="rect" href="endpoint.html">Endpoint</a> <a shape="rect" 
href="uris.html">URIs</a>.</p><p>For more detail see <a shape="rect" 
href="how-do-i-configure-endpoints.html">Configuring Endpoints and 
Components</a>.</p><h2 id="Spring-SpringCacheIdempotentRepo
 sitory">Spring Cache Idempotent Repository</h2><p>Available as of 
<strong>Camel 2.17.1</strong></p><parameter 
ac:name="language">xml</parameter><plain-text-body>&lt;bean id="repo" 
class="org.apache.camel.spring.processor.idempotent.SpringCacheIdempotentRepository"&gt;
     &lt;constructor-arg&gt;
-       &lt;bean 
class=&quot;org.springframework.cache.guava.GuavaCacheManager&quot;/&gt;
+       &lt;bean class="org.springframework.cache.guava.GuavaCacheManager"/&gt;
     &lt;/constructor-arg&gt;
-    &lt;constructor-arg value=&quot;idempotent&quot;/&gt;
+    &lt;constructor-arg value="idempotent"/&gt;
 &lt;/bean&gt;
 
-&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    &lt;route id=&quot;idempotent-cache&quot;&gt;
-        &lt;from uri=&quot;direct:start&quot; /&gt;
-        &lt;idempotentConsumer messageIdRepositoryRef=&quot;repo&quot; 
skipDuplicate=&quot;true&quot;&gt;
+&lt;camelContext xmlns="http://camel.apache.org/schema/spring"&gt;
+    &lt;route id="idempotent-cache"&gt;
+        &lt;from uri="direct:start" /&gt;
+        &lt;idempotentConsumer messageIdRepositoryRef="repo" 
skipDuplicate="true"&gt;
             &lt;header&gt;MessageId&lt;/header&gt;
-            &lt;to 
uri=&quot;log:org.apache.camel.spring.processor.idempotent?level=INFO&amp;amp;showAll=true&amp;amp;multiline=true&quot;
 /&gt;
-            &lt;to uri=&quot;mock:result&quot;/&gt;
+            &lt;to 
uri="log:org.apache.camel.spring.processor.idempotent?level=INFO&amp;amp;showAll=true&amp;amp;multiline=true"
 /&gt;
+            &lt;to uri="mock:result"/&gt;
         &lt;/idempotentConsumer&gt;
     &lt;/route&gt;
-&lt;/camelContext&gt;]]></script>
-</div></div><p>&#160;</p><p>&#160;</p><h3 
id="Spring-CamelContextAware">CamelContextAware</h3><p>If you want to be 
injected with the <a shape="rect" href="camelcontext.html">CamelContext</a> in 
your POJO just implement the <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContextAware.html";>CamelContextAware
 interface</a>; then when Spring creates your POJO 
the&#160;<strong><code>CamelContext</code></strong> will be injected into your 
POJO. Also see the <a shape="rect" href="bean-integration.html">Bean 
Integration</a> for further injections.</p><h2 
id="Spring-IntegrationTesting">Integration Testing</h2><p>To avoid a hung route 
when testing using Spring Transactions see the note about Spring Integration 
Testing under&#160;<a shape="rect" 
href="transactional-client.html">Transactional Client</a>.</p><h3 
id="Spring-Seealso">See also</h3><ul><li><a shape="rect" 
href="tutorial-jmsremoting.html">Spring JMS Tutorial</
 a></li><li><a shape="rect" 
href="creating-a-new-spring-based-camel-route.html">Creating a new Spring based 
Camel Route</a></li><li><a shape="rect" href="spring-example.html">Spring 
example</a></li><li><a shape="rect" href="xml-reference.html">Xml 
Reference</a></li><li><a shape="rect" 
href="advanced-configuration-of-camelcontext-using-spring.html">Advanced 
configuration of CamelContext using Spring</a></li><li><a shape="rect" 
href="how-do-i-import-routes-from-other-xml-files.html">How Do I Import Routes 
From Other XML Files?</a></li></ul></div>
+&lt;/camelContext&gt;</plain-text-body><p>&#160;</p><p>&#160;</p><h3 
id="Spring-CamelContextAware">CamelContextAware</h3><p>If you want to be 
injected with the <a shape="rect" href="camelcontext.html">CamelContext</a> in 
your POJO just implement the <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContextAware.html";>CamelContextAware
 interface</a>; then when Spring creates your POJO 
the&#160;<strong><code>CamelContext</code></strong> will be injected into your 
POJO. Also see the <a shape="rect" href="bean-integration.html">Bean 
Integration</a> for further injections.</p><h2 
id="Spring-IntegrationTesting">Integration Testing</h2><p>To avoid a hung route 
when testing using Spring Transactions see the note about Spring Integration 
Testing under&#160;<a shape="rect" 
href="transactional-client.html">Transactional Client</a>.</p><h3 
id="Spring-Seealso">See also</h3><ul><li><a shape="rect" 
href="tutorial-jmsremoting.
 html">Spring JMS Tutorial</a></li><li><a shape="rect" 
href="creating-a-new-spring-based-camel-route.html">Creating a new Spring based 
Camel Route</a></li><li><a shape="rect" href="spring-example.html">Spring 
example</a></li><li><a shape="rect" href="xml-reference.html">Xml 
Reference</a></li><li><a shape="rect" 
href="advanced-configuration-of-camelcontext-using-spring.html">Advanced 
configuration of CamelContext using Spring</a></li><li><a shape="rect" 
href="how-do-i-import-routes-from-other-xml-files.html">How Do I Import Routes 
From Other XML Files?</a></li></ul></div>
         </td>
         <td valign="top">
           <div class="navigation">


Reply via email to