Quartz Connector
When scheduling tasks, it’s recommended that you instead resort to the Poll Scope
The Quartz Connector supports the scheduling of programmatic events, both inside and outside your Mule flow. Through a quartz endpoint, you can trigger flows that don’t depend on receiving any external input to execute at scheduled times.
For instance, an inbound Quartz endpoint can trigger inbound events, such as temperature reports from a remote location, at regular intervals.
Outbound Quartz endpoints can delay otherwise imminent events. For example, you can prevent outgoing email from being sent as soon as it has completed processing in your Mule flow. Instead, you can use Quartz to delay sending it until the top of the next hour.
Polling
Note that you also have the option to use a Poll scope at the beginning of a flow, which also supports Cron expressions and watermarks. Read more about the Poll scope.
When running in an environment with multiple workers and nodes, a Quartz scheduler, by default, runs on each node whereas the Poll Scope is "smart" enough to only run on a single node. A Quartz scheduler can be configured to work the same as the Poll Scope, but requires configuration of a JDBC JobStore.
To Install this Connector
-
In Anypoint Studio, click the Exchange icon in the Studio taskbar.
-
Click Login in Anypoint Exchange.
-
Search for the connector and click Install.
-
Follow the prompts to install the connector.
When Studio has an update, a message displays in the lower right corner, which you can click to install the update.
Configuration
Quartz endpoint configuration consists of two stages:
-
Decide where you want to place the Quartz endpoint within your Mule flow, then drag it from the Palette to the appropriate place in the sequence of building blocks that make up your Mule flow.
-
If you place the Quartz endpoint at the beginning of the flow, it acts as an inbound endpoint (such as, message source), controlling the timing of inbound events.
-
If you place the Quartz building block in the middle or at the end of the flow, it serves as an outbound endpoint, controlling the times at which outbound events take place.
-
-
Configure the Quartz endpoint by providing values for the fields on the various tabs on the properties editor, which you open by clicking the Quartz icon on the Message Flow canvas.
General Tab
Field | Description |
---|---|
Display Name |
Defaults to the generic endpoint name, which in this case is Quartz. Change the display name, which must be alpha-numeric, to reflect the endpoint’s specific role, such as, |
Stateful |
Determines if the job is persistent. If so, the job detail request persists for each request. More importantly, each job triggered executes sequentially. If the job takes longer than the next trigger, the job waits for the current job to execute. |
Job Name |
Specify a useful internal name for identifying the job (such as, event) performed by this endpoint, such as |
Cron Expression |
Specify a cron expression for scheduling events, which are also referred to as "jobs". See the Wikipedia Cron for an introduction to cron syntax. This property is required if the Repeat interval property is not specified. |
Repeat Interval |
Specify the time between jobs. This property is required if a Cron expression is not specified. |
Repeat Count |
Specify the number of times to repeat the job. If set to -1, the job repeats indefinitely. |
Start Delay |
Specify the time (in ms) that lapses before the first job is triggered. |
Job |
Add the associated element that runs the job. The available options are:
|
Connector Configuration |
Use the dropdown list to select a previously configured connector configuration for this endpoint. If you have not created a connector configuration for this type of endpoint, you can do so from this window by clicking Add. Click Edit to modify a previously created global element. |
Advanced Tab
Field | Description |
---|---|
Address |
Enter the address for this endpoint, such as, |
Response Timeout |
Specify how long the endpoint must wait for a response (in ms). |
Encoding |
Choose from a drop-down list the character set used for message data. (Such as, UTF-8). |
Disable Transport Transformer |
Check this box if you do not want to use the endpoint’s default response transport. |
MIME Type |
Select from the drop-down list one of the formats this endpoint supports. |
Connector Endpoint |
Use the drop-down list to select a previously configured global endpoint template, if any exist. If you have not created a global element for this type of endpoint, you do so by clicking Add and completing the fields on the pane that appears. Click Edit to modify a previously created global element. |
Enable default events tracking |
Enable default business event tracking for this endpoint. |
See Also
-
See the Quartz Transport Reference for details on setting the properties for a Quartz endpoint using an XML editor.
-
Read a post in MuleSoft’s blog about using Quartz in Mule.
-
Read Quartz’s documentation.
-
Read about the Poll scope.