Author: buildbot
Date: Fri Jan 19 17:20:20 2018
New Revision: 1024029

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/routepolicy.html

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/routepolicy.html
==============================================================================
--- websites/production/camel/content/routepolicy.html (original)
+++ websites/production/camel/content/routepolicy.html Fri Jan 19 17:20:20 2018
@@ -85,7 +85,23 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 
id="RoutePolicy-RoutePolicy">RoutePolicy</h2><p><strong>Available as of Camel 
2.1</strong></p><p>A route policy 
<strong><code>org.apache.camel.spi.RoutePolicy</code></strong> is used to 
control route(s) at runtime. For example you can use it to determine whether a 
route should be running or not. However the policies can support any kind of 
use cases.</p><h3 id="RoutePolicy-Howitworks">How it works</h3><p>You associate 
a route with a given <strong><code>RoutePolicy</code></strong> and then during 
runtime Camel will invoke callbacks on this policy where you can implement your 
custom logic. Camel provides a support class that is a good base class to 
extend 
<strong><code>org.apache.camel.impl.RoutePolicySupport</code></strong>.</p><p>There
 are these callbacks invoked:</p><ul class="alternate"><li><code>onInit</code> 
<strong>Camel 2.3</strong></li><li><code>onRemove</code> <strong>Camel 
2.9</strong></li><li><code>onStart</code> <strong>Camel 2.9<
 /strong></li><li><code>onStop</code> <strong>Camel 
2.9</strong></li><li><code>onSuspend</code> <strong>Camel 
2.9</strong></li><li><code>onResume</code> <strong>Camel 
2.9</strong></li><li><code>onExchangeBegin</code></li><li><code>onExchangeDone</code></li></ul><p>See
 the Javadoc of the 
<strong><code>org.apache.camel.spi.RoutePolicy</code></strong> for more 
details. And also the implementation of the 
<strong><code>org.apache.camel.impl.ThrottlingInflightRoutePolicy</code></strong>
 for a concrete example.</p><p>Camel provides the following policies out of the 
box:</p><ul 
class="alternate"><li><p><strong><code>org.apache.camel.impl.ThrottlingInflightRoutePolicy</code></strong>
 - a throttling based policy that automatic suspends/resumes route(s) based on 
metrics from the current in flight exchanges. You can use this to dynamically 
throttle e.g. a <a shape="rect" href="jms.html">JMS</a> consumer, to avoid it 
consuming too fast.</p></li></ul><p>As of <strong>Camel 2.5</strong>, Camel also
  provides an ability to schedule routes to be activated, deactivated, 
suspended and/or resumed at certain times during the day using a <a 
shape="rect" href="scheduledroutepolicy.html">ScheduledRoutePolicy</a> (offered 
via the <a shape="rect" class="external-link" 
href="http://camel.apache.org/quartz.html";>camel-quartz</a> component).</p><div 
class="confluence-information-macro confluence-information-macro-tip"><p 
class="title">SuspendableService</p><span class="aui-icon aui-icon-small 
aui-iconfont-approve confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>If you want to dynamic 
suspend/resume routes as the 
<strong><code>org.apache.camel.impl.ThrottlingRoutePolicy</code></strong> does 
then its advised to use 
<strong><code>org.apache.camel.SuspendableService</code></strong> as it allows 
for fine grained <strong><code>suspend</code></strong> and 
<strong><code>resume</code></strong> operations. And use the 
<strong><code>org.apache.camel.util.Serv
 iceHelper</code></strong> to aid when invoking these operations as it support 
fallback for regular <strong><code>org.apache.camel.Service</code></strong> 
instances.</p></div></div><h4 
id="RoutePolicy-ThrottlingInflightRoutePolicy"><code>ThrottlingInflightRoutePolicy</code></h4><p>The&#160;<strong><code>ThrottlingInflightRoutePolicy</code></strong>
 is triggered when an <a shape="rect" href="exchange.html">Exchange</a> is 
complete, which means that it requires at least one <a shape="rect" 
href="exchange.html">Exchange</a> to be complete before it 
<em>works</em>.</p><p>The throttling inflight route policy has the following 
options:</p><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Option</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>scope</code></p><
 /td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Route</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>A scope for either <strong><code>Route</code></strong> 
or <strong><code>Context</code></strong> which defines if the current number of 
inflight exchanges is context based or for that particular 
route.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>maxInflightExchanges</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The maximum threshold when the 
throttling will start to suspend the route if the current number of inflight 
exchanges is higher than this value.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>resumePercentOfMax</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>70</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>A 
percentage&#160;<strong><code>0..100
 </code></strong> which defines when the throttling should resume again in case 
it has been suspended.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>loggingLevel</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>INFO</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>The logging level used for logging the 
throttling activity.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>logger</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>ThrottlingInflightRoutePolicy</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The logger 
category.</p></td></tr></tbody></table></div><div 
class="confluence-information-macro 
confluence-information-macro-information"><p 
class="title">ThrottlingInflightRoutePolicy compared to the [Throttler] 
EIP</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div class="confluence-informati
 on-macro-body"><p>The 
<strong><code>ThrottlingInflightRoutePolicy</code></strong> compared to <a 
shape="rect" href="throttler.html">Throttler</a> is that it does 
<strong>not</strong> block during throttling. It does throttling that is 
approximate based, meaning that its more coarse grained and not explicit 
precise as the <a shape="rect" href="throttler.html">Throttler</a>. The <a 
shape="rect" href="throttler.html">Throttler</a> can be much more accurate and 
only allow a specific number of messages being passed per a given time unit. 
Also the <strong><code>ThrottlingInflightRoutePolicy</code></strong> is based 
its metrics on number of inflight exchanges where as <a shape="rect" 
href="throttler.html">Throttler</a> is based on number of messages per time 
unit.</p></div></div><h4 
id="RoutePolicy-ScheduledRoutePolicy(SimpleandCronbased)usingcamelQuartz"><code>ScheduledRoutePolicy</code>
 (Simple and Cron based) using camel Quartz</h4><p>For more details check out 
the following links</p><h
 3 id="RoutePolicy-ConfiguringPolicy">Configuring Policy</h3><p>You configure 
the route policy as follows from Java DSL, using the 
<strong><code>routePolicy</code></strong> method:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h2 
id="RoutePolicy-RoutePolicy">RoutePolicy</h2><p><strong>Available as of Camel 
2.1</strong></p><p>A route policy 
<strong><code>org.apache.camel.spi.RoutePolicy</code></strong> is used to 
control route(s) at runtime. For example you can use it to determine whether a 
route should be running or not. However the policies can support any kind of 
use cases.</p><h3 id="RoutePolicy-Howitworks">How it works</h3><p>You associate 
a route with a given <strong><code>RoutePolicy</code></strong> and then during 
runtime Camel will invoke callbacks on this policy where you can implement your 
custom logic. Camel provides a support class that is a good base class to 
extend 
<strong><code>org.apache.camel.impl.RoutePolicySupport</code></strong>.</p><p>There
 are these callbacks invoked:</p><ul class="alternate"><li><code>onInit</code> 
<strong>Camel 2.3</strong></li><li><code>onRemove</code> <strong>Camel 
2.9</strong></li><li><code>onStart</code> <strong>Camel 2.9<
 /strong></li><li><code>onStop</code> <strong>Camel 
2.9</strong></li><li><code>onSuspend</code> <strong>Camel 
2.9</strong></li><li><code>onResume</code> <strong>Camel 
2.9</strong></li><li><code>onExchangeBegin</code></li><li><code>onExchangeDone</code></li></ul><p>See
 the Javadoc of the 
<strong><code>org.apache.camel.spi.RoutePolicy</code></strong> for more 
details. And also the implementation of the 
<strong><code>org.apache.camel.impl.ThrottlingInflightRoutePolicy</code></strong>&#160;or
 
<strong><code>org.apache.camel.impl.ThrottlingExceptionRoutePolicy&#160;</code></strong>for
 a concrete example.</p><p>Camel provides the following policies out of the 
box:</p><ul 
class="alternate"><li><p><strong><code>org.apache.camel.impl.ThrottlingInflightRoutePolicy</code></strong>
 - a throttling based policy that automatic suspends/resumes route(s) based on 
metrics from the current in flight exchanges. You can use this to dynamically 
throttle e.g. a <a shape="rect" href="jms.html">JMS</a> consum
 er, to avoid it consuming too 
fast.</p></li><li><strong><code>org.apache.camel.impl.<strong><code>ThrottlingExceptionRoutePolicy</code></strong></code></strong>&#160;-
 a policy that implements the circuit breaker EIP. This policy will stop 
consuming from an endpoint based on the number of exceptions that are thrown on 
the route. This can be used to avoid scenarios where failures on the route 
cause the message to be rolled back and then re-consumed without being able to 
be processed.</li></ul><p>As of <strong>Camel 2.5</strong>, Camel also provides 
an ability to schedule routes to be activated, deactivated, suspended and/or 
resumed at certain times during the day using a <a shape="rect" 
href="scheduledroutepolicy.html">ScheduledRoutePolicy</a> (offered via the <a 
shape="rect" class="external-link" 
href="http://camel.apache.org/quartz.html";>camel-quartz</a> component).</p><div 
class="confluence-information-macro confluence-information-macro-tip"><p 
class="title">SuspendableService</p>
 <span class="aui-icon aui-icon-small aui-iconfont-approve 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>If you want to dynamic 
suspend/resume routes as the 
<strong><code>org.apache.camel.impl.ThrottlingRoutePolicy</code></strong> does 
then its advised to use 
<strong><code>org.apache.camel.SuspendableService</code></strong> as it allows 
for fine grained <strong><code>suspend</code></strong> and 
<strong><code>resume</code></strong> operations. And use the 
<strong><code>org.apache.camel.util.ServiceHelper</code></strong> to aid when 
invoking these operations as it support fallback for regular 
<strong><code>org.apache.camel.Service</code></strong> 
instances.</p></div></div><h4 
id="RoutePolicy-ThrottlingInflightRoutePolicy"><code>ThrottlingInflightRoutePolicy</code></h4><p>The&#160;<strong><code>ThrottlingInflightRoutePolicy</code></strong>
 is triggered when an <a shape="rect" href="exchange.html">Exchange</a> is 
complete, which means that it
  requires at least one <a shape="rect" href="exchange.html">Exchange</a> to be 
complete before it <em>works</em>.</p><p>The throttling inflight route policy 
has the following options:</p><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Option</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>scope</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>Route</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>A scope for either 
<strong><code>Route</code></strong> or <strong><code>Context</code></strong> 
which defines if the current number of inflight exchanges is context based or 
for that particular route.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>maxInflightExchanges</code></p></td><td co
 lspan="1" rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The maximum threshold when the 
throttling will start to suspend the route if the current number of inflight 
exchanges is higher than this value.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>resumePercentOfMax</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>70</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>A 
percentage&#160;<strong><code>0..100</code></strong> which defines when the 
throttling should resume again in case it has been 
suspended.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>loggingLevel</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>INFO</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>The logging level used for logging the 
throttling activity.</p></td></tr><tr><td colspan="1" rowspan="1" class="conflu
 enceTd"><p><code>logger</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>ThrottlingInflightRoutePolicy</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The logger 
category.</p></td></tr></tbody></table></div><div 
class="confluence-information-macro 
confluence-information-macro-information"><p 
class="title">ThrottlingInflightRoutePolicy compared to the [Throttler] 
EIP</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>The 
<strong><code>ThrottlingInflightRoutePolicy</code></strong> compared to <a 
shape="rect" href="throttler.html">Throttler</a> is that it does 
<strong>not</strong> block during throttling. It does throttling that is 
approximate based, meaning that its more coarse grained and not explicit 
precise as the <a shape="rect" href="throttler.html">Throttler</a>. The <a 
shape="rect" href="throttler.html">Throttler</a> can be much more accu
 rate and only allow a specific number of messages being passed per a given 
time unit. Also the <strong><code>ThrottlingInflightRoutePolicy</code></strong> 
is based its metrics on number of inflight exchanges where as <a shape="rect" 
href="throttler.html">Throttler</a> is based on number of messages per time 
unit.</p></div></div><h4 
id="RoutePolicy-ThrottlingExceptionRoutePolicy"><code>ThrottlingExceptionRoutePolicy</code></h4><p>The&#160;<strong><code><strong><code>ThrottlingExceptionRoutePolicy</code></strong></code></strong>
 (available as of Camel 2.19) is an implementation of the circuit breaker EIP. 
It is triggered when an&#160;<a shape="rect" 
href="exchange.html">Exchange</a>&#160;is complete (<span style="font-family: 
monospace;">onExchangeDone</span>), which means that it requires at least 
one&#160;<a shape="rect" href="exchange.html">Exchange</a>&#160;to be complete 
before it&#160;works.</p><p>The&#160;throttling exception route policy has the 
following states:</p><ul><li>cl
 osed: the route will consume messages from the defined 
endpoint.&#160;</li><li>open: the route will be suspended and will not consume 
messages from the defined endpoint.<ul><li>the route is opened when a 
configurable number of exceptions occurs withing a specified time 
frame.</li></ul></li><li>half-open: the route will perform a check to see if 
the route can be moved from open to closed.&#160;<ul><li>this will occur by 
resuming the route and checking for exceptions or by calling an implementation 
of 
the&#160;<strong><code>ThrottlingExceptionHalfOpenHandler.</code></strong><ul><li>If
 an exception is caught when the route is resumed it will 
re-open,&#160;otherwise it will move to the closed state.&#160;</li><li>If the 
implemenation of <strong><code>ThrottlingExceptionHalfOpenHandler 
</code></strong>is provided and the isReadyToBeClosed method returns true the 
route will be moved to the closed state. Otherwise it will be moved to the open 
state.</li></ul></li></ul></li></ul><p>The thro
 ttling exception route policy has the following options:</p><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Option</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>failureThreshold</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The number of exceptions that 
must be caught before the circuit controlling the route is 
opened.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>failureWindow</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>The time range, in milliseconds, in which 
the number of exceptions must occur in order for the circuit to be o
 pened.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>halfOpenAfter</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd">Defines how long the circuit will remain open, 
in milliseconds, before the circuit is moved into the half-open 
state.</td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>throttledExceptions</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd">An optional 
<span>List&lt;Class&lt;?&gt;&gt;</span> of exceptions. If this option is set, 
only these exceptions will count towards meeting the failureThreshold. If this 
list is left as null any exception will be counted toward the 
failureThreshold.</td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>halfOpenHandler</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>nu
 ll</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>An 
optional implementation of <span>the 
<strong><code>ThrottlingExceptionHalfOpenHandler.</code></strong></span><span> 
When provided, the policy will delegate the handling of the half-open state to 
this class. If it is left as null, the route will resume during the half open 
state. It is possible for more than one message to be read from the endpoint 
when the route is resumed during the half-open 
state.&#160;</span></p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>keepOpen</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>This option <span>(new as of Camel 2.21) 
</span>allows the circuit to be placed in the open state when set to true. It 
overrides all other settings and the half open state will not be processed. The 
circuit will not be moved out of the open state until this option is set to fa
 lse.</p></td></tr></tbody></table></div><p>In the example below, a simple 
route is configured to open after 2 exceptions are thrown within 30 seconds of 
each other. When 60 seconds have expired the route will be moved into the 
half-open state. <span>The check performed during the half-open state will be 
delegated to the&#160;</span>CustomHalfOpenHandler. This class provides an 
option to check for resources that may be failing independent of resuming the 
route.&#160;</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
+public void configure() throws Exception {
+       int threshold = 2;
+       long failureWindow = 30000;
+       long halfOpenAfter = 60000;
+
+       ThrottlingExceptionRoutePolicy policy = new 
ThrottlingExceptionRoutePolicy(threshold, failureWindow, halfOpenAfter, null);
+       policy.setHalfOpenHandler(new CustomHalfOpenHandler());
+
+       from(url)
+               .routePolicy(policy)
+        .log(&quot;${body}&quot;)
+               .to(&quot;log:foo?groupSize=10&quot;)
+        .to(&quot;mock:result&quot;);
+   }]]></script>
+</div></div><p>&#160;</p><p><code style="font-weight: 
bold;">ScheduledRoutePolicy</code><span style="font-weight: bold;"> (Simple and 
Cron based) using camel Quartz</span></p><p>For more details check out the 
following links</p><h3 id="RoutePolicy-ConfiguringPolicy">Configuring 
Policy</h3><p>You configure the route policy as follows from Java DSL, using 
the <strong><code>routePolicy</code></strong> method:</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[  RoutePolicy myPolicy = new MyRoutePolicy();
   from(&quot;seda:foo&quot;).routePolicy(myPolicy).to(&quot;mock:result&quot;);
 ]]></script>


Reply via email to