SimpleScheduledRoutePolicy
Available as of Camel 2.6
SimpleScheduledRoutePolicy is a ScheduledRoutePolicy that facilitates route activation, de-activation, suspension and resumption of routes based on a Quartz SimpleTrigger.
Maven users will need to add a camel-quartz
dependency to their pom.xml
to avail this capability.
...
Tip | ||
---|---|---|
| ||
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. |
Tip | ||
---|---|---|
| ||
From Camel 2.12.2 onwards you can also make use of the Quartz2 based implementation of this route policy. |
How it works
In order to use a SimpleScheduledRoutePolicy it is necessary to instantiate an object of the type org.apache.camel.routepolicy.quartz.SimpleScheduledRoutePolicy
.
...
Parameter Name | Type | Default Value | Description |
---|---|---|---|
routeStartDate | java.util.Date |
| the initial scheduled Date and time for route start |
routeStartRepeatCount | int |
| no of times to repeat the job |
routeStartRepeatInterval | long |
| the time interval in milliseconds to trigger the next attempt to start the route |
- Stopping a route
Parameter Name | Type | Default | Description |
---|---|---|---|
routeStopDate | java.util.Date |
| the initial scheduled Date and time for route stop |
routeStopRepeatCount | int |
| no of times to repeat the job |
routeStopRepeatInterval | long |
| the time interval in milliseconds to trigger the next attempt to stop the route |
routeStopGracePeriod | int | 10 seconds | the time period to wait before initiating graceful route stop |
routeStopTimeUnit | long | TimeUnit.MILLISECONDS | the time unit for the grace period expressed as java.util.concurrent.TimeUnit |
- Suspending a route
Parameter Name | Type | Default | Description |
---|---|---|---|
routeSuspendDate | java.util.Date |
| the initial scheduled Date and time for route suspension |
routeSuspendRepeatCount | int |
| no of times to repeat the job |
routeSuspendRepeatInterval | long |
| the time interval in milliseconds to trigger the next attempt to suspend the route |
- Resuming a route
Parameter Name | Type | Default | Description |
---|---|---|---|
routeResumeDate | java.util.Date |
| the initial scheduled Date and time for route start |
routeResumeRepeatCount | int |
| no of times to repeat the job |
routeResumeRepeatInterval | long |
| the time interval in milliseconds to trigger the next attempt to resume the route |
Once the org.apache.camel.routepolicy.quartz.SimpleScheduledRoutePolicy
is created it can be wired into the camel route as follows
...