Nav

Managing Schedules (CloudHub)

logo cloud active logo hybrid disabled logo server disabled logo pcf disabled

The CloudHub console includes a Schedules tab in the left navigation menu where you can view and control any polling elements within the flows of your deployed applications. CloudHub automatically detects the polling elements from within your flows and lists them on the Schedules tab. On this tab, you can select the polling elements and enable or disable them, change the polling frequency, or run them immediately – all during runtime, without making any changes in the underlying application.

Use Cases

The Schedules tab is especially useful for the following use cases:

  • You have a job that runs nightly but you want to trigger it right now so you can debug it. You want to do this in runtime so you don’t need to update the schedule in your underlying application.

  • You want to change your schedules in your application at runtime without redeploying.

  • You want to disable a scheduled job while one of the applications you are connecting to is undergoing maintenance.

  • You want runtime visibility into the schedules in your application.

Considerations

  • Schedulers are managed by CloudHub and they are triggered only in one worker if more are available.

  • While CloudHub supports polling frequencies in seconds, you may see discrepancies of a few seconds between individual polling calls. Setting a polling frequency higher than once in 10 seconds is not recommended.

  • If a scheduled job is missed (not triggered) one or more times because the application is down, CloudHub triggers the job once as soon as the application restarts.

  • Cloudhub scheduler reads a schedule job configuration every time it is run. This means that if you update the schedule time, the change is not immediate. The job will execute as it was already configured and only then the scheduler will pick up the next setting for the next run. To have your changes applied immediately, run your jobs after every schedule update.

Viewing Application Schedules in the Console

To use the scheduling feature in the Runtime Manager, deploy an application that includes one or more polling elements. For example, the application illustrated below includes two simple flows, each with a polling scope.

scheduling+cloudhub


    
            
         
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
 
    <flow name="synchronize-accounts" doc:name="synchronize-accounts">
        <poll frequency="300000" doc:name="Poll">
            <logger level="INFO" doc:name="Start" message="Start Account Synchronization ${salesforce.username}"/>
        </poll>
        <logger level="INFO" doc:name="End" message="End Account Synchronization"/>
    </flow>
    <flow name="synchronize-contacts" doc:name="synchronize-contacts">
        <poll frequency="600000" doc:name="Poll">
            <logger level="INFO" doc:name="Start" message="Start Contact Synchronization ${salesforce.username}"/>
        </poll>
        <logger level="INFO" doc:name="End" message="End Contact Synchronization"/>
    </flow>
</mule>

Because CloudHub synchronizes your schedules automatically, overriding any synchronize property set on the flows containing the polling scopes, there is no need to do any other special configuration. 

Once it is deployed, select the application in your Runtime Manager console, and click Schedules in the left navigation menu. Runtime Manager lists the polling elements in your application in the order that they appear in your application: 

SchedulesView

Note: The name of each element is determined by the doc:name attribute in the polling scopes, if you add one in the XML. If you do not specify a doc:name, then CloudHub applies the name, yourFlowname Poll.

The Last Run column shows the exact date and time when each polling element ran most recently. You can view the Logs to see further details about when the jobs started and ended their scheduled runs. 

Managing Schedules at Runtime

To manage the polling elements:

  1. Check the boxes next to the individual elements that you want to manage.

  2. Click Run now if you want to override the schedule and run that job immediately.

  3. Click Disable to suspend a polling element. CloudHub does not run the polling job until you Enable it once again.

  4. In the *Schedule *column, CloudHub lists each polling element’s polling frequency.

  5. Click the frequency of a polling element to open the schedule editor:

    SchedulesChangeTime

  6. In the schedule editor, adjust the polling frequency of the element, or disable the polling frequency by unchecking Enabled

    CHSetPollFreq

  7. Click Switch to advanced mode if you would like to use Cron expressions, and click Quick reference for information on required fields and allowed values.  Click more to view the Quartz CronTrigger Tutorial. If you change the Cron setting, click Update. Or click Cancel to exit. Click Switch to basic mode to exit advanced mode.

    CHAdvModeWithQkRef

    Note that all schedules are based in UTC timezone, regardless of what region your CloudHub workers are on. Also the timezone configuration is ignored.
  8. To see the schedule tab in action, select one or more of the scheduled jobs and click Run Now. "The schedules have been queued to run" message appears.

    SchedulesRunNow

  9. To check the result, click Logs in the left navigation menu, and view the entries to verify that the job you selected ran as expected:
    SchedulesLogs