Author: buildbot Date: Fri Jun 13 04:17:53 2014 New Revision: 912402 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/throttler.html Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available. Modified: websites/production/camel/content/throttler.html ============================================================================== --- websites/production/camel/content/throttler.html (original) +++ websites/production/camel/content/throttler.html Fri Jun 13 04:17:53 2014 @@ -86,41 +86,16 @@ <tbody> <tr> <td valign="top" width="100%"> -<div class="wiki-content maincontent"><h3 id="Throttler-Throttler">Throttler</h3> - -<p>The Throttler Pattern allows you to ensure that a specific endpoint does not get overloaded, or that we don't exceed an agreed SLA with some external service.</p> - -<h3 id="Throttler-Options">Options</h3> - -<div class="confluenceTableSmall"> -<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Name </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Default Value </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Description </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>maximumRequestsPerPeriod</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Maximum number of requests per period to throttle. This option must be provided as a positive number. Notice, in the XML DSL, from <strong>Camel 2.8</strong> onwards this option is configured using an <a shape="rect" href="expression.html" title="Expression">Expression</a> instead of an attribute. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>timePeriodMillis</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>1000</code> </p></td><td colspan="1" rows pan="1" class="confluenceTd"><p> The time period in milliseconds, in which the throttler will allow at most <code>maximumRequestsPerPeriod</code> number of messages. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>asyncDelayed</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.4:</strong> If enabled then any messages which is delayed happens asynchronously using a scheduled thread pool. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>executorServiceRef</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.4:</strong> Refers to a custom <a shape="rect" href="threading-model.html" title="Threading Model">Thread Pool</a> to be used if <code>asyncDelay</code> has been enabled. </p></td></tr><tr><td colspan="1" rowspan=" 1" class="confluenceTd"><p> <code>callerRunsWhenRejected</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>true</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.4:</strong> Is used if <code>asyncDelayed</code> was enabled. This controls if the caller thread should execute the task if the thread pool rejected the task. </p></td></tr></tbody></table> -</div> - -<h3 id="Throttler-Examples">Examples</h3> - -<p><strong>Using the <a shape="rect" href="fluent-builders.html">Fluent Builders</a></strong></p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<div class="wiki-content maincontent"><h3 id="Throttler-Throttler">Throttler</h3><p>The Throttler Pattern allows you to ensure that a specific endpoint does not get overloaded, or that we don't exceed an agreed SLA with some external service.</p><h3 id="Throttler-Options">Options</h3><div class="confluenceTableSmall"> +<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Name </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Default Value </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Description </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>maximumRequestsPerPeriod</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Maximum number of requests per period to throttle. This option must be provided as a positive number. Notice, in the XML DSL, from <strong>Camel 2.8</strong> onwards this option is configured using an <a shape="rect" href="expression.html" title="Expression">Expression</a> instead of an attribute. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>timePeriodMillis</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>1000</code> </p></td><td colspan="1" rows pan="1" class="confluenceTd"><p> The time period in milliseconds, in which the throttler will allow at most <code>maximumRequestsPerPeriod</code> number of messages. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>asyncDelayed</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.4:</strong> If enabled then any messages which is delayed happens asynchronously using a scheduled thread pool. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>executorServiceRef</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.4:</strong> Refers to a custom <a shape="rect" href="threading-model.html" title="Threading Model">Thread Pool</a> to be used if <code>asyncDelay</code> has been enabled. </p></td></tr><tr><td colspan="1" rowspan=" 1" class="confluenceTd"><p> <code>callerRunsWhenRejected</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>true</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.4:</strong> Is used if <code>asyncDelayed</code> was enabled. This controls if the caller thread should execute the task if the thread pool rejected the task. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>rejectExection</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.14:</strong> If this option is true, throttler throws the RejectExecutionException when the request rate exceeds the limit. </p></td></tr></tbody></table> +</div><h3 id="Throttler-Examples">Examples</h3><p><strong>Using the <a shape="rect" href="fluent-builders.html">Fluent Builders</a></strong></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ from("seda:a").throttle(3).timePeriodMillis(10000).to("log:result", "mock:result"); ]]></script> -</div></div> - -<p>So the above example will throttle messages all messages received on <strong>seda:a</strong> before being sent to <strong>mock:result</strong> ensuring that a maximum of 3 messages are sent in any 10 second window.</p> - -<p>Note that since <code>timePeriodMillis</code> defaults to 1000 milliseconds, just setting the <code>maximumRequestsPerPeriod</code> has the effect of setting the maximum number of requests per second. So to throttle requests at 100 requests per second between two endpoints, it would look more like this...</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ -from("seda:a").throttle(100).to("seda:b"); +</div></div><p>So the above example will throttle messages all messages received on <strong>seda:a</strong> before being sent to <strong>mock:result</strong> ensuring that a maximum of 3 messages are sent in any 10 second window.</p><p>Note that since <code>timePeriodMillis</code> defaults to 1000 milliseconds, just setting the <code>maximumRequestsPerPeriod</code> has the effect of setting the maximum number of requests per second. So to throttle requests at 100 requests per second between two endpoints, it would look more like this...</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[from("seda:a").throttle(100).to("seda:b"); ]]></script> -</div></div> - -<p>For further examples of this pattern in use you could look at the <a shape="rect" class="external-link" href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlerTest.java?view=markup">junit test case</a></p> - -<p><strong>Using the <a shape="rect" href="spring-xml-extensions.html">Spring XML Extensions</a></strong></p> -<h4 id="Throttler-Camel2.7.xorolder">Camel 2.7.x or older</h4> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>For further examples of this pattern in use you could look at the <a shape="rect" class="external-link" href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlerTest.java?view=markup">junit test case</a></p><p><strong>Using the <a shape="rect" href="spring-xml-extensions.html">Spring XML Extensions</a></strong></p><h4 id="Throttler-Camel2.7.xorolder">Camel 2.7.x or older</h4><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ <route> <from uri="seda:a" /> @@ -129,11 +104,7 @@ from("seda:a").throttle(100).t </throttle> </route> ]]></script> -</div></div> - -<h4 id="Throttler-Camel2.8onwards">Camel 2.8 onwards</h4> -<p>In Camel 2.8 onwards you must set the maximum period as an <a shape="rect" href="expression.html">Expression</a> as shown below where we use a <a shape="rect" href="constant.html">Constant</a> expression:</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h4 id="Throttler-Camel2.8onwards">Camel 2.8 onwards</h4><p>In Camel 2.8 onwards you must set the maximum period as an <a shape="rect" href="expression.html">Expression</a> as shown below where we use a <a shape="rect" href="constant.html">Constant</a> expression:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ <route> <from uri="seda:a"/> @@ -144,12 +115,7 @@ from("seda:a").throttle(100).t </throttle> </route> ]]></script> -</div></div> - -<h3 id="Throttler-Dynamicallychangingmaximumrequestsperperiod">Dynamically changing maximum requests per period</h3> -<p><strong>Available as of Camel 2.8</strong> <br clear="none"> -Since we use an <a shape="rect" href="expression.html">Expression</a> you can adjust this value at runtime, for example you can provide a header with the value. At runtime Camel evaluates the expression and converts the result to a <code>java.lang.Long</code> type. In the example below we use a header from the message to determine the maximum requests per period. If the header is absent, then the <a shape="rect" href="throttler.html">Throttler</a> uses the old value. So that allows you to only provide a header if the value is to be changed:</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h3 id="Throttler-Dynamicallychangingmaximumrequestsperperiod">Dynamically changing maximum requests per period</h3><p><strong>Available as of Camel 2.8</strong> <br clear="none"> Since we use an <a shape="rect" href="expression.html">Expression</a> you can adjust this value at runtime, for example you can provide a header with the value. At runtime Camel evaluates the expression and converts the result to a <code>java.lang.Long</code> type. In the example below we use a header from the message to determine the maximum requests per period. If the header is absent, then the <a shape="rect" href="throttler.html">Throttler</a> uses the old value. So that allows you to only provide a header if the value is to be changed:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ <route> <from uri="direct:expressionHeader"/> @@ -160,20 +126,10 @@ Since we use an <a shape="rect" href="ex </throttle> </route> ]]></script> -</div></div> - -<h3 id="Throttler-Asynchronousdelaying">Asynchronous delaying</h3> -<p><strong>Available as of Camel 2.4</strong></p> - -<p>You can let the <a shape="rect" href="throttler.html">Throttler</a> use non blocking asynchronous delaying, which means Camel will use a scheduler to schedule a task to be executed in the future. The task will then continue routing. This allows the caller thread to not block and be able to service other messages, etc.</p> - -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ -from("seda:a").throttle(100).asyncDelayed().to("seda:b"); +</div></div><h3 id="Throttler-Asynchronousdelaying">Asynchronous delaying</h3><p><strong>Available as of Camel 2.4</strong></p><p>You can let the <a shape="rect" href="throttler.html">Throttler</a> use non blocking asynchronous delaying, which means Camel will use a scheduler to schedule a task to be executed in the future. The task will then continue routing. This allows the caller thread to not block and be able to service other messages, etc.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[from("seda:a").throttle(100).asyncDelayed().to("seda:b"); ]]></script> -</div></div> - -<h4 id="Throttler-UsingThisPattern">Using This Pattern</h4> +</div></div><p></p><h4 id="Throttler-UsingThisPattern">Using This Pattern</h4> <p>If you would like to use this EIP Pattern then please read the <a shape="rect" href="getting-started.html">Getting Started</a>, you may also find the <a shape="rect" href="architecture.html">Architecture</a> useful particularly the description of <a shape="rect" href="endpoint.html">Endpoint</a> and <a shape="rect" href="uris.html">URIs</a>. Then you could try out some of the <a shape="rect" href="examples.html">Examples</a> first before trying this pattern out.</p></div> </td>