Cloud Scheduler trigger

The Cloud Scheduler trigger lets you schedule your integration executions for defined time periods or regular intervals across multiple regions.

Cloud Scheduler triggers leverage the Cloud Scheduler services to provide a fully managed enterprise-grade cron job scheduler within Apigee Integration. Using this trigger, you can now manage all your cron jobs created within your integration, both from the Apigee Integration UI, and the Cloud Scheduler dashboard. Additionally, the Cloud Scheduler trigger also lets you deploy cross-region cron jobs to schedule your integration executions.

For example, if you have provisioned your integration in us-central1, you can use the Cloud Scheduler trigger to deploy a cron job in asia-east1 (or any of the supported Google Cloud regions for Cloud Scheduler) to call your integration's endpoint at us-central1.

Before you begin

Ensure that you perform the following tasks in your Google Cloud project before configuring the Cloud Scheduler trigger:

  1. Enable the Cloud Scheduler API (cloudscheduler.googleapis.com).

    Enable Cloud Scheduler API

  2. Confirm that you have a Google service account with the Apigee Integration Invoker role assigned. If you don't have a service account, you must create a new one, and assign the Apigee Integration Invoker role to it.

    For information about creating and managing service accounts, see Creating and managing service accounts

    For information about the predefined Apigee Integration roles, see Predefined IAM roles.

Add the Cloud Scheduler trigger

To add a Cloud Scheduler trigger to your integration, perform the following steps:

  1. In the Apigee UI, select your Apigee Organization.
  2. Click Develop > Integrations.
  3. Select an existing integration or create a new integration by clicking Create Integration.

    If you are creating a new integration:

    1. Enter a name and description in the Create Integration dialog.
    2. Select a Region for the integration from the list of supported regions.
    3. Click Create.

    This opens the integration in the integration designer.

  4. In the integration designer navigation bar, click +Add a task/trigger > Triggers to view the list of available triggers.
  5. Click and place the Cloud Scheduler trigger element in the integration editor.

Configure the Cloud Scheduler trigger

To configure a Cloud Scheduler trigger, perform the following steps:

  1. Click the Cloud Scheduler trigger element in the integration editor to open the trigger configuration pane.

    Specify the schedule of the Cloud Scheduler trigger using either of the following options:

    • Basic: Use the user interface to configure the cron job schedule.
    • Advanced: Use a unix-cron expression to configure the cron job schedule.
  2. (For Basic option) Select the Basic tab and do the following in the indicated fields:
    1. Times: Select the time intervals at which the integration must run.
      • Run at a specific time: Select this option to run the integration at a specific time.
      • Repeat by the hour: Select this option to repeatedly run the integration on an hourly basis.
      • Repeat by the minute: Select this option to repeatedly run the integration as per the specified number of minutes
    2. Days: Select the days on which the integration must run. You can choose to run the integration every day, or on specific days of the week, or on a specific day of the month.
    3. Months: Select the month(s) in which the integration must run. You can choose to run the integration every month, or during specific months.
  3. (For Advanced option) Select the Advanced tab and specify the schedule of the cron job using a cron expression.

    The cron expression has five values that must be specified in the following order:

    1. Minute (0-59)
    2. Hour (0-23)
    3. Day of the month (1-31)
    4. Month, either of the following values:
      • A number 1-12
      • A three-letter month abbreviation (For example, Jan, Feb, Mar)
    5. Day of week, either of the following values:
      • A number from 0 - 6 starting with Sunday as 0
      • A three-letter day abbreviation (For example, Mon, Tue, Wed)

    For example, to run the integration on the first day of every month, use the * * 1 * * cron expression.

    For more information, see Configure cron job schedules.

  4. Region: Select the region where your Cloud Scheduler job will be deployed.
  5. Service account email: Enter the created Google service account email address.

Trigger output

For each Cloud Scheduler trigger that is configured and published in your integration version, Apigee Integration creates a new Cloud Scheduler job in your Google Cloud project.

A Cloud Scheduler job is created using the following naming convention to avoid any job duplication errors:

    INTEGRATION_NAME__VINTEGRATION_VERSION__CLOUD_SCHEDULER_TRIGGER_NUMBER
    

Example: DemoIntegration__V1__1

Trigger logs

A Cloud Scheduler trigger generates logs at the start and end of each integration execution. You can view the Cloud Scheduler trigger logs in the Cloud Logging Logs Explorer page:

  1. In the Google Cloud console, go to the Cloud Scheduler page.

    Go to Cloud Scheduler

  2. Locate your Cloud Scheduler job and click View in the Logs column.

    The Cloud Logging Logs Explorer page appears displaying the logs generated by the Cloud Scheduler trigger.

Edit a Cloud Scheduler trigger

Apigee Integration

To edit your Cloud Scheduler trigger from Apigee Integration, do the following steps:

  1. In the Apigee UI, select your Apigee Organization.
  2. Click Develop > Integrations.
  3. Select the integration that you want to edit.
  4. In the integration editor, click the Version dropdown, and select the integration version containing the Cloud Scheduler trigger that you want to edit.
  5. Unpublish and enable editing If the selected integration version is published (in active state).
  6. Click the Cloud Scheduler trigger element in the integration editor to open the trigger configuration pane.
  7. Modify the Cloud Scheduler job configurations as desired.

Cloud Scheduler

You can edit your Cloud Scheduler trigger by modifying the configuration of your Cloud Scheduler job from Cloud Scheduler:

  1. In the Google Cloud console, go to Cloud Scheduler.

    Go to Cloud Scheduler

  2. Select the Cloud Scheduler job to edit.
  3. Click Edit.
  4. Modify the Cloud Scheduler job configurations as desired.

Pause, Resume, Copy a Cloud Scheduler job

Apigee Integration doesn’t support pause, resume, and copy operations for a Cloud Scheduler job created using the Cloud Scheduler trigger.

The Cloud Scheduler trigger throws an error in the trigger configuration pane if you manually pause the execution of a Cloud Scheduler job from Cloud Scheduler.

For more information about the Cloud Scheduler trigger error messages, see Troubleshoot Cloud Scheduler trigger. For information about pausing and resuming a cron job using Cloud Scheduler, see Pause or resume a job

Delete a Cloud Scheduler job

You can delete a Cloud Scheduler job either from within your integration in Apigee Integration or from Cloud Scheduler.

Apigee Integration

To delete a Cloud Scheduler job from Apigee Integration, do the following steps:

  1. In the Apigee UI, select your Apigee Organization.
  2. Click Develop > Integrations.
  3. Select the integration that you want to edit.
  4. In the integration editor, click the Version dropdown, and select the integration version containing the Cloud Scheduler trigger that you want to delete.
  5. Unpublish the selected integration version.

    The Cloud Scheduler job for the corresponding integration version is deleted.

Cloud Scheduler

To delete a Cloud Scheduler job from Cloud Scheduler, do the following steps:

  1. In the Google Cloud console, go to Cloud Scheduler.

    Go to Cloud Scheduler

  2. Select the Cloud Scheduler job to delete.
  3. Click Delete.

    The Cloud Scheduler job for the corresponding integration version is deleted.

Best practices

As a best practice, unpublish any Cloud Scheduler triggers when they are no longer needed. If you leave a redundant Cloud Scheduler trigger published, the trigger will continue to invoke the integration automatically, which might cause additional billing charges.

Troubleshoot Cloud Scheduler trigger

The following table describes the errors that you might encounter in Cloud Scheduler trigger, and the corresponding causes for the errors.

Error location Occurrence of error Error message Possible causes Resolution
Trigger configuration pane > Error Message When the Cloud Scheduler job stops the execution of your integration The configured Cloud Scheduler job CLOUD_SCHEDULER_JOB doesn’t exist. It might be deleted from your Google Cloud project. The Cloud Scheduler job is deleted using Cloud Scheduler. Create a new integration version to overwrite your existing Cloud Scheduler job.
The configured Cloud Scheduler job CLOUD_SCHEDULER_JOB is PAUSED. You must RESUME the job from your Google Cloud project. The Cloud Scheduler job is paused using Cloud Scheduler. Resume the Cloud Scheduler job from Cloud Scheduler.
The configured Cloud Scheduler job CLOUD_SCHEDULER_JOB is DISABLED due to an internal system error. Check the Trigger logs to identity the issue. Create a new integration version to overwrite your existing Cloud Scheduler job.
The configured Cloud Scheduler job CLOUD_SCHEDULER_JOB is in an UPDATE_FAILED state due to a failed CloudScheduler.UpdateJob operation. The provided service account doesn’t have the required IAM permissions. To recover a job from this state, retry CloudScheduler.UpdateJob operation until a successful response is received.
The last execution of the Cloud Scheduler job CLOUD_SCHEDULER_JOB failed due to CLOUD_SCHEDULER_JOB_ISSUE. Learn more. CLOUD_SCHEDULER_JOB_ISSUE NA