App Connect

App Connect

Join this online user group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only

Configuring scheduled events with IBM App Connect 

Wed July 01, 2020 08:48 AM

Published on January 17, 2018 / Updated on February 5, 2019

IBM App Connect now provides a Scheduler node that you can use to trigger your flows at regular intervals or at specific dates and times. This post describes how to configure your flows to run at scheduled times. We also illustrate how you can use the timestamp emitted at the start of each scheduled time period to retrieve information that was created, generated, or processed during those time periods.

When you use the Scheduler in a flow, it must be added as the first node in a flow.

  1. Click New > Event-driven flow, click the Toolbox tab, and select Scheduler.
    Select Scheduler from the Toolbox
  2. To configure the Scheduler to trigger your flow at regular intervals, you’ll need to set the schedule type to Repeating interval. Then, from the Run every drop-down lists, select a value and one of the following options for the interval unit:
    • Hour: Trigger the flow once every x hours. The first trigger will happen x hours after the flow is started (on the appropriate day).
    • Minute: Trigger the flow once every x minutes. The first trigger will happen x minutes after the flow is started (on the appropriate day).

    Next, select one or more days on which the flow should be triggered, and then specify an associated timezone. (The default timezone is UTC.) When you start the flow, it will run at the specified interval over the selected days.

    Note: If there’s a break of one or more days in the schedule, the schedule will restart at 00:00 in the specified timezone on the next scheduled day. For example, if a flow that’s scheduled to run every 10 hours on Tuesday and Wednesday is switched on on Monday, the flow will initially run at these times: 10:00 on Tuesday, 20:00 on Tuesday, 06:00 on Wednesday, and 16:00 on Wednesday. The flow will then subsequently run on 00:00 on Tuesday, 10:00 on Tuesday, 20:00 on Tuesday, 06:00 on Wednesday, and 16:00 on Wednesday.

    You can also trigger the flow to run once immediately after it’s switched on by selecting the Also run the flow when it’s first switched on check box.

  3. To configure the Scheduler to trigger your flow on a specific date or time of day/week/month/year, you’ll need to set the schedule type to Calendar. From the Timezone drop-down list, you can also optionally specify a timezone for triggering the flow. (The default timezone is UTC.) You can use the Run every drop-down lists to configure a schedule as follows:
    • Hour: Trigger the flow every hour at x minutes past the hour. For example, trigger the flow every hour at 30 minutes past the hour.
    • Day: Trigger the flow every day at x hours and y minutes. For example, trigger the flow daily at 1400 hours and 30 minutes in the America/New York timezone.
    • Week: Trigger the flow every week on day x of the week, at y hours and z minutes. For example, trigger the flow every week on Monday at 0900 hours and 15 minutes in the Asia/Calcutta timezone.
    • Month: Trigger the flow every month on day x, at y hours and z minutes. For example, trigger the flow every month on the 28th day, at 0900 hours and 15 minutes in the Asia/Calcutta timezone.
    • Year: Trigger the flow every year on day x of month m, at y hours and z minutes. For example, trigger the flow every year on the 13th day of March, at 0900 hours and 15 minutes in the GMT timezone.

    You can also trigger the flow to run once immediately after it’s switched on by selecting the Also run the flow when it’s first switched on check box.

  4. Complete your flow in the usual way by adding the actions and logic that you need. The following example shows a sample flow that’s configured to run Salesforce and Slack actions on a schedule. (We’ll describe what this flow does in the Scenario section.)
    Flow image for Scheduler scenario

    The Scheduler emits the following output, which you can map to in subsequent nodes in your flow:

    • Current event time: The time when the current schedule was triggered
    • Previous event time: The time when the previous schedule was triggered

    Note:

    • Both of these time stamps are presented in ISO format and will be in the default UTC timezone that’s defined for the schedule type.
    • The Previous event time value is, by default, set to 1 Jan 1970 when the flow is first triggered.
  5. From the banner, open the options menu [⋮] and click Start flow to switch on your flow. Then click Dashboard to exit the flow.
  6. Test your flow by verifying that it’s being triggered based on your scheduled configuration.

Scenario

Let’s suppose you’ve configured the Scheduler to trigger your flow immediately after the flow is started, and then at repeating hourly intervals every Thursday only.

Every hour, you want to retrieve details of new accounts that were created in Salesforce after the flow was last triggered.

Salesforce settings for the Retrieve accounts action

And then you’d like to send a message to a channel in Slack to notify interested parties of the number of accounts (with associated account names) that were created within each hourly time span.

Slack settings for the Create message action

Because you selected the Also run the flow when it’s first switched on check box in the Scheduler node, you’ll see a message in Slack as soon as the flow starts. This message should provide a count of all accounts that were created between 1 Jan 1970 and the start time of the flow. At hourly intervals after this start time, you should see messages detailing the new accounts that were created during that time span.

Results of the flow in Slack

Tip: If you had left the Also run the flow when it’s first switched on check box clear in the Scheduler node, the first Slack message would have been generated an hour after the flow started, and would have included details of all accounts that were created between 1 Jan 1970 and the end of the first schedule.



#AppConnect
#Scheduler

Statistics
0 Favorited
29 Views
0 Files
0 Shares
0 Downloads