You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2017/05/05 00:37:38 UTC
svn commit: r1011658 [2/2] - in /websites/production/camel/content:
book-component-appendix.html book-in-one-page.html cache/main.pageCache
disruptor.html seda.html
Modified: websites/production/camel/content/seda.html
==============================================================================
--- websites/production/camel/content/seda.html (original)
+++ websites/production/camel/content/seda.html Fri May 5 00:37:38 2017
@@ -89,7 +89,7 @@
<div class="wiki-content maincontent"><h2 id="SEDA-SEDAComponent">SEDA Component</h2><p>The <strong><code>seda:</code></strong> component provides asynchronous <a shape="rect" class="external-link" href="http://www.eecs.harvard.edu/~mdw/proj/seda/" rel="nofollow">SEDA</a> behavior, so that messages are exchanged on a <a shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/BlockingQueue.html" rel="nofollow">BlockingQueue</a> and consumers are invoked in a separate thread from the producer.</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 proc
essed. If you 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 <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&option=value&...</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"> </td><td colspan="1" rowspan="1" class="confluenceTd"> </td><td colspan="1" rowspan="1" class="confluenceTd"><p>The maximum capacity of t
he <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> </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"> </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"> </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"> </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 <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 <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 <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 <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 <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"> </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 <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">This option is used when <strong><code>size</code></strong> is not specified.</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 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" 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><t
d 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 <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 <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">Only one of the options <span><strong><code>discardIfNoConsumers</code></strong></span> and <span><strong><code>failIfNoConsumers</code></strong></span> can be enabled at the same time.</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 <strong>seda</strong> queue with no active consumers.<span> </span></p><div class="confluence-in
formation-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">Only one of the options <strong><code>discardIfNoConsumers</code></strong> and <strong><code>failIfNoConsumers</code></strong> can be enabled at the same time.</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">
+</div></div><p>Where <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&option=value&...</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"> </td><td colspan="1" rowspan="1" class="confluenceTd"> </td><td colspan="1" rowspan="1" class="confluenceTd"><p>The maximum capacity of t
he <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> </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"> </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"> </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"> </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 <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 <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 <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 <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 <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"> </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 <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 <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 <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 <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 <strong>seda</strong> queue with no active consumers.<span> </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 <strong><code>discardIfNoConsumers</code></strong> and <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[<bean id="arrayQueue" class="java.util.ArrayBlockingQueue">
<constructor-arg index="0" value="10"> <!-- size -->
<constructor-arg index="1" value="true"> <!-- fairness -->