camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r1012531 - in /websites/production/camel/content: cache/main.pageCache routepolicy.html
Date Fri, 19 May 2017 17:18:52 GMT
Author: buildbot
Date: Fri May 19 17:18:52 2017
New Revision: 1012531

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 May 19 17:18:52 2017
@@ -85,7 +85,7 @@
 	<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 <code>org.apache.camel.spi.RoutePolicy</code>
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 <code>RoutePolicy</code> and then during runtime Camel will invoke callbacks
on this policy where you can implement your custom logic.</p><p>Camel provides
a support class that is a good base class to extend <code>org.apache.camel.impl.RoutePolicySupport</code>.</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>C
 amel 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 <code>org.apache.camel.spi.RoutePolicy</code> for more details.<br
clear="none"> And also the implementation of the <code>org.apache.camel.impl.ThrottlingInflightRoutePolicy</code>
for a concrete example.</p><p>Camel provides the following policies out of the
box:</p><ul class="alternate"><li><code>org.apache.camel.impl.ThrottlingInflightRoutePolicy</code>
- a throttling based policy that automatic suspends/resumes route(s) based on metrics from
the current in flight exchanges. You can use this to dynamic throttle e.g. a <a shape="rect"
href="jms.html">JMS</a> consumer to avoid it consuming too fast.</li></ul><p>As
of <strong>Camel 2.5</strong>, Camel also provides an ability to schedule routes
to be activated, de-activated, suspended and/or resu
 med 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 <code>org.apache.camel.impl.ThrottlingRoutePolicy</code>
does then its advised to use <code>org.apache.camel.SuspendableService</code>
as it allows for fine grained <code>suspend</code> and <code>resume</code>
operations. And use the <code>org.apache.camel.util.ServiceHelper</code> to aid
when invoking these operations as it support fallback for regular <code>org.apache.camel.Service</code>
instances.</p></div></div><h4 id="Route
 Policy-ThrottlingInflightRoutePolicy">ThrottlingInflightRoutePolicy</h4><p>The
ThrottlingInflightRoutePolicy 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>scope</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Route</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>A scope for either <code>Route</code>
or <code>Context</code> which defines if the current number of inflight exchanges
is context b
 ased or for that particular route.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>maxInflightExchanges</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>1000</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 inlfight exchanges is higher than this
value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>resumePercentOfMax</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>70</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>A percentage 0..100 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>loggingLevel</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>INFO</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The logging level used for logging the throttling
activity.</p></td></tr><tr><t
 d colspan="1" rowspan="1" class="confluenceTd"><p>logger</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>ThrottlingInflightRoutePolicy</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
<code>ThrottlingInflightRoutePolicy</code> 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
<code>ThrottlingInflightRoutePolicy</code> 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">ScheduledRoutePolicy
(Simple and Cron based) using camel Quartz</h4><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 <code>routePolicy</code>
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 <code>org.apache.camel.spi.RoutePolicy</code>
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 <code>RoutePolicy</code> and then during runtime Camel will invoke callbacks
on this policy where you can implement your custom logic.</p><p>Camel provides
a support class that is a good base class to extend <code>org.apache.camel.impl.RoutePolicySupport</code>.</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>C
 amel 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 <code>org.apache.camel.spi.RoutePolicy</code> for more details.<br
clear="none"> And also the implementation of the <code>org.apache.camel.impl.ThrottlingInflightRoutePolicy</code>
for a concrete example.</p><p>Camel provides the following policies out of the
box:</p><ul class="alternate"><li><code>org.apache.camel.impl.ThrottlingInflightRoutePolicy</code>
- a throttling based policy that automatic suspends/resumes route(s) based on metrics from
the current in flight exchanges. You can use this to dynamic throttle e.g. a <a shape="rect"
href="jms.html">JMS</a> consumer to avoid it consuming too fast.</li></ul><p>As
of <strong>Camel 2.5</strong>, Camel also provides an ability to schedule routes
to be activated, de-activated, suspended and/or resu
 med 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 <code>org.apache.camel.impl.ThrottlingRoutePolicy</code>
does then its advised to use <code>org.apache.camel.SuspendableService</code>
as it allows for fine grained <code>suspend</code> and <code>resume</code>
operations. And use the <code>org.apache.camel.util.ServiceHelper</code> to aid
when invoking these operations as it support fallback for regular <code>org.apache.camel.Service</code>
instances.</p></div></div><h4 id="Route
 Policy-ThrottlingInflightRoutePolicy">ThrottlingInflightRoutePolicy</h4><p>The
ThrottlingInflightRoutePolicy 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>scope</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Route</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>A scope for either <code>Route</code>
or <code>Context</code> which defines if the current number of inflight exchanges
is context b
 ased or for that particular route.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>maxInflightExchanges</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>1000</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>resumePercentOfMax</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>70</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>A percentage 0..100 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>loggingLevel</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>INFO</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The logging level used for logging the throttling
activity.</p></td></tr><tr><t
 d colspan="1" rowspan="1" class="confluenceTd"><p>logger</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>ThrottlingInflightRoutePolicy</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
<code>ThrottlingInflightRoutePolicy</code> 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
<code>ThrottlingInflightRoutePolicy</code> 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">ScheduledRoutePolicy
(Simple and Cron based) using camel Quartz</h4><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 <code>routePolicy</code>
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>



Mime
View raw message