Simulating upcoming events and tuning your schedule

Before associating, that is to say, applying your schedule to a task, simulate events that this schedule could trigger in the future and then tune the schedule accordingly.

Before you begin

  • Generate an access token:
    • For users, generate a personal access token. For further information, see Generating a Personal Access Token.
    • For service accounts, generate a service account token. For further information about how to generate a service account token, see Generating a service account token. Once generated, a service account token expires after 30 minutes. If it expires, generate a new token using the POST method at the endpoint https://api.{env}.cloud.talend.com/security/oauth/token.

Procedure

  1. Issue the following request to simulate the upcoming events to be triggered by your schedule.

    method: GET
    endpoint: https://api.<env>.cloud.talend.com/orchestration/schedules/<scheduleId>/events
    headers: {
          "Content-Type": "application/json",
          "Authorization": "Bearer <your_personal_access_token_or_service_account_token>"
              }
    payload: {
           "to": "1742567692000"
              }
    

    The to field is used to specify the end date time in milliseconds of the period for which you simulate upcoming events.

    In the response, each upcoming event is returned with the trigger that sets it off so that you can easily identify the trigger you need to update for this schedule.

     [
       {
        "date": "2022-06-22T10:04:00.000Z",
        "sourceTriggerName": "my_trigger_1"
       },
       {
        "date": "2022-06-22T10:09:00.000Z",
        "sourceTriggerName": "my_trigger_1"
       },
       {
        "date": "2022-06-23T10:04:00.000Z",
        "sourceTriggerName": "my_trigger_1"
       },
       {
        "date": "2022-06-23T10:09:00.000Z",
        "sourceTriggerName": "my_trigger_1"
        },
       {
        "date": "2022-06-24T10:04:00.000Z",
        "sourceTriggerName": "my_trigger_1"
       },
       {
        "date": "2022-06-24T10:09:00.000Z",
        "sourceTriggerName": "my_trigger_1"
       },
       {
        "date": "2022-06-25T10:04:00.000Z",
        "sourceTriggerName": "my_trigger_1"
       },
       {
        "date": "2022-06-25T10:09:00.000Z",
        "sourceTriggerName": "my_trigger_1"
       }
     ]
    

    For example, if you discover that an event will be triggered during the maintenance time of your system, you may need to update the trigger to start that event earlier or later.

  2. Issue the following API call to update triggers of a schedule:

    method: PUT
    endpoint: https://api.<env>.cloud.talend.com/orchestration/schedules/<scheduleId>/triggers
    headers: {
          "Content-Type": "application/json",
          "Authorization": "Bearer <your_personal_access_token_or_service_account_token>"
              }
    payload: {
           "Trigger": {
               "name": "My unique trigger name",
               "startDate": "2022-06-17",
               "timeZone": "Europe/Kiev",
               "type": "ONCE",
               atTimes: {
                   "type": "AT_TIME",
                   "time": "11:00"
                        }
                       }
              }
    

    This request updates the trigger with the name My unique trigger name by changing the event start date to 2022-06-17 (June 17, 2022). The other triggers defined for this schedule stay unchanged.

    The same requirements about defining a new trigger apply on the trigger updates. When you send the request, an automatic check proceeds.

Results

Your schedule is now fine-tuned to start events at the most appropriate times.

It is ready to be associated to a task so as to trigger events for this task as scheduled.