camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > SimpleScheduledRoutePolicy
Date Tue, 26 Oct 2010 13:13:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CAMEL/SimpleScheduledRoutePolicy">SimpleScheduledRoutePolicy</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
        <br/>
                         <h4>Changes (20)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-unchanged" >h2. SimpleScheduledRoutePolicy <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">*Available
as of Camel 2.6* <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-unchanged" >SimpleScheduledRoutePolicy is a [ScheduledRoutePolicy]
that facilitates route activation, de-activation, suspension and resumption of routes based
on a [Quartz] SimpleTrigger. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >Maven users will need to add a
<span class="diff-changed-words"><span class="diff-added-chars"style="background-color:
#dfd;">{{</span>camel-quartz<span class="diff-added-chars"style="background-color:
#dfd;">}}</span></span> dependency to their {{pom.xml}} to avail this capability.
<br></td></tr>
            <tr><td class="diff-unchanged" >{code:xml} <br>&lt;dependency&gt;
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >* Starting a route <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >|| Parameter Name || Type || Default
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">Value</span>
|| Description || <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> routeStartDate
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> java.util.Date
<span class="diff-changed-words">|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span>
|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span></span>
the initial scheduled Date and time for route start <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> routeStartRepeatCount
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> int <span
class="diff-changed-words">|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span>
|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span></span>
no of times to repeat the job <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> routeStartRepeatInterval
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> long <span
class="diff-changed-words">|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span>
|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span></span>
the time interval in milliseconds to trigger the next attempt to start the route <span
class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>* Stopping a route  <br>
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">||
Parameter Name || Type || Default || Description || <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> routeStopDate
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> java.util.Date
<span class="diff-changed-words">|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span>
|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span></span>
the initial scheduled Date and time for route stop <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> routeStopRepeatCount
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> int <span
class="diff-changed-words">|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span>
|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span></span>
no of times to repeat the job <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> routeStopRepeatInterval
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> long <span
class="diff-changed-words">|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span>
|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span></span>
the time interval in milliseconds to trigger the next attempt to stop the route <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> routeStopGracePeriod
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> int <span
class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> 10 seconds
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> the time
period to wait before initiating graceful route stop <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> routeStopTimeUnit
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> long <span
class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> TimeUnit.MILLISECONDS
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> the time
unit for the grace period expressed as java.util.concurrent.TimeUnit <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>* Suspending a route <br>
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">||
Parameter Name || Type || Default || Description || <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> routeSuspendDate
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> java.util.Date
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||
||</span> <span class="diff-added-words"style="background-color: #dfd;">|  |</span>
the initial scheduled Date and time for route suspension <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> routeSuspendRepeatCount
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> int <span
class="diff-changed-words">|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span>
|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span></span>
no of times to repeat the job <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> routeSuspendRepeatInterval
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> long <span
class="diff-changed-words">|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span>
|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span></span>
the time interval in milliseconds to trigger the next attempt to suspend the route <span
class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>* Resuming a route <br>
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">||
Parameter Name || Type || Default || Description || <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> routeResumeDate
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> java.util.Date
<span class="diff-changed-words">|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span>
|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span></span>
the initial scheduled Date and time for route start <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> routeResumeRepeatCount
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> int <span
class="diff-changed-words">|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span>
|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span></span>
no of times to repeat the job <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> routeResumeRepeatInterval
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> long <span
class="diff-changed-words">|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span>
|<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span></span>
the time interval in milliseconds to trigger the next attempt to resume the route <span
class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">||</span>
<span class="diff-added-words"style="background-color: #dfd;">|</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>Once the {{org.apache.camel.routepolicy.quartz.SimpleScheduledRoutePolicy}}
is created it can be wired into the camel route as follows <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="SimpleScheduledRoutePolicy-SimpleScheduledRoutePolicy"></a>SimpleScheduledRoutePolicy</h2>
<p><b>Available as of Camel 2.6</b></p>

<p>SimpleScheduledRoutePolicy is a <a href="/confluence/display/CAMEL/ScheduledRoutePolicy"
title="ScheduledRoutePolicy">ScheduledRoutePolicy</a> that facilitates route activation,
de-activation, suspension and resumption of routes based on a <a href="/confluence/display/CAMEL/Quartz"
title="Quartz">Quartz</a> SimpleTrigger.</p>

<p>Maven users will need to add a <tt>camel-quartz</tt> dependency to their
<tt>pom.xml</tt> to avail this capability.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;dependency&gt;</span>
    <span class="code-tag">&lt;groupId&gt;</span>org.apache.camel<span
class="code-tag">&lt;/groupId&gt;</span>
    <span class="code-tag">&lt;artifactId&gt;</span>camel-quartz<span
class="code-tag">&lt;/artifactId&gt;</span>
    <span class="code-tag">&lt;version&gt;</span>x.x.x<span class="code-tag">&lt;/version&gt;</span>
    <span class="code-tag"><span class="code-comment">&lt;!-- use the same
version as your Camel core version --&gt;</span></span>
<span class="code-tag">&lt;/dependency&gt;</span>
</pre>
</div></div>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><b>Relationship to the Quartz
component</b><br />All Scheduled route policies share the scheduler created by
the Quartz component. In this way, scheduler, jobs and triggers can be managed in a common
and consistent way.</td></tr></table></div>

<h3><a name="SimpleScheduledRoutePolicy-Howitworks"></a>How it works</h3>

<p>In order to use a SimpleScheduledRoutePolicy it is necessary to instantiate an object
of the type <tt>org.apache.camel.routepolicy.quartz.SimpleScheduledRoutePolicy</tt>.</p>

<p>In order to perform a route operation at a given time the following information must
be provided.</p>

<ul>
	<li>Starting a route</li>
</ul>


<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Parameter Name </th>
<th class='confluenceTh'> Type </th>
<th class='confluenceTh'> Default </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> routeStartDate </td>
<td class='confluenceTd'> java.util.Date </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> the initial scheduled Date and time for route start </td>
</tr>
<tr>
<td class='confluenceTd'> routeStartRepeatCount </td>
<td class='confluenceTd'> int </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> no of times to repeat the job </td>
</tr>
<tr>
<td class='confluenceTd'> routeStartRepeatInterval </td>
<td class='confluenceTd'> long </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> the time interval in milliseconds to trigger the next attempt
to start the route </td>
</tr>
</tbody></table>
</div>


<ul>
	<li>Stopping a route</li>
</ul>


<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Parameter Name </th>
<th class='confluenceTh'> Type </th>
<th class='confluenceTh'> Default </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> routeStopDate </td>
<td class='confluenceTd'> java.util.Date </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> the initial scheduled Date and time for route stop </td>
</tr>
<tr>
<td class='confluenceTd'> routeStopRepeatCount </td>
<td class='confluenceTd'> int </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> no of times to repeat the job </td>
</tr>
<tr>
<td class='confluenceTd'> routeStopRepeatInterval </td>
<td class='confluenceTd'> long </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> the time interval in milliseconds to trigger the next attempt
to stop the route </td>
</tr>
<tr>
<td class='confluenceTd'> routeStopGracePeriod </td>
<td class='confluenceTd'> int </td>
<td class='confluenceTd'> 10 seconds </td>
<td class='confluenceTd'> the time period to wait before initiating graceful route stop
</td>
</tr>
<tr>
<td class='confluenceTd'> routeStopTimeUnit </td>
<td class='confluenceTd'> long </td>
<td class='confluenceTd'> TimeUnit.MILLISECONDS </td>
<td class='confluenceTd'> the time unit for the grace period expressed as java.util.concurrent.TimeUnit
</td>
</tr>
</tbody></table>
</div>


<ul>
	<li>Suspending a route</li>
</ul>


<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Parameter Name </th>
<th class='confluenceTh'> Type </th>
<th class='confluenceTh'> Default </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> routeSuspendDate </td>
<td class='confluenceTd'> java.util.Date </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> the initial scheduled Date and time for route suspension </td>
</tr>
<tr>
<td class='confluenceTd'> routeSuspendRepeatCount </td>
<td class='confluenceTd'> int </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> no of times to repeat the job </td>
</tr>
<tr>
<td class='confluenceTd'> routeSuspendRepeatInterval </td>
<td class='confluenceTd'> long </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> the time interval in milliseconds to trigger the next attempt
to suspend the route </td>
</tr>
</tbody></table>
</div>


<ul>
	<li>Resuming a route</li>
</ul>


<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Parameter Name </th>
<th class='confluenceTh'> Type </th>
<th class='confluenceTh'> Default </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> routeResumeDate </td>
<td class='confluenceTd'> java.util.Date </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> the initial scheduled Date and time for route start </td>
</tr>
<tr>
<td class='confluenceTd'> routeResumeRepeatCount </td>
<td class='confluenceTd'> int </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> no of times to repeat the job </td>
</tr>
<tr>
<td class='confluenceTd'> routeResumeRepeatInterval </td>
<td class='confluenceTd'> long </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> the time interval in milliseconds to trigger the next attempt
to resume the route </td>
</tr>
</tbody></table>
</div>


<p>Once the <tt>org.apache.camel.routepolicy.quartz.SimpleScheduledRoutePolicy</tt>
is created it can be wired into the camel route as follows</p>

<h3><a name="SimpleScheduledRoutePolicy-Configuringthepolicy"></a>Configuring
the policy</h3>

<ul>
	<li>In Java</li>
</ul>


<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java"> 
SimpleScheduledRoutePolicy policy = <span class="code-keyword">new</span> SimpleScheduledRoutePolicy();
<span class="code-object">long</span> startTime = <span class="code-object">System</span>.currentTimeMillis()
+ 3000L;
policy.setRouteStartDate(<span class="code-keyword">new</span> Date(startTime));
policy.setRouteStartRepeatCount(1);
policy.setRouteStartRepeatInterval(3000);
                
from(<span class="code-quote">"direct:start"</span>)
   .routeId(<span class="code-quote">"test"</span>)
   .routePolicy(policy)
   .to(<span class="code-quote">"mock:success"</span>);
</pre>
</div></div>

<ul>
	<li>Using Spring</li>
</ul>


<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&lt;bean id=<span class="code-quote">"date"</span> class=<span class="code-quote">"org.apache.camel.routepolicy.quartz.SimpleDate"</span>/&gt;

&lt;bean id=<span class="code-quote">"startPolicy"</span> class=<span class="code-quote">"org.apache.camel.routepolicy.quartz.SimpleScheduledRoutePolicy"</span>&gt;
    &lt;property name=<span class="code-quote">"routeStartDate"</span> ref=<span
class="code-quote">"date"</span>/&gt;
    &lt;property name=<span class="code-quote">"routeStartRepeatCount"</span>
value=<span class="code-quote">"1"</span>/&gt;
    &lt;property name=<span class="code-quote">"routeStartRepeatInterval"</span>
value=<span class="code-quote">"3000"</span>/&gt;    	
&lt;/bean&gt; 
 	
&lt;camelContext xmlns=<span class="code-quote">"http:<span class="code-comment">//camel.apache.org/schema/spring"</span>&gt;
</span>    &lt;route id=<span class="code-quote">"myroute"</span> routePolicyRef=<span
class="code-quote">"startPolicy"</span>&gt;
        &lt;from uri=<span class="code-quote">"direct:start"</span>/&gt;
        &lt;to uri=<span class="code-quote">"mock:success"</span>/&gt;
    &lt;/route&gt;
&lt;/camelContext&gt;
</pre>
</div></div>

<h3><a name="SimpleScheduledRoutePolicy-SeeAlso"></a>See Also</h3>
<p><a href="/confluence/display/CAMEL/ScheduledRoutePolicy" title="ScheduledRoutePolicy">ScheduledRoutePolicy</a>
- for information on policy based scheduling capability for camel routes<br/>
<a href="/confluence/display/CAMEL/RoutePolicy" title="RoutePolicy">RoutePolicy</a>
- for information on route policies in general<br/>
<a href="/confluence/display/CAMEL/Quartz" title="Quartz">Quartz</a> -for more
information on the quartz component</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/SimpleScheduledRoutePolicy">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=23339415&revisedVersion=3&originalVersion=2">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/SimpleScheduledRoutePolicy?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message