Understanding Triggers

You're viewing Apigee X documentation.
View Apigee Edge documentation.

A trigger is an external event that initiates a task, or sequence of tasks, in an integration. You can think of a trigger as an entry point to your integration - the event tied to the trigger causes the tasks associated with the trigger to run.

You can add multiple triggers to your integration. However, when an event occurs, only the trigger associated with the event begins executing its tasks. For more information, see Adding multiple triggers in an integration.

Apigee Integration provides the following out-of-the-box triggers:

API Trigger

An API Trigger lets you run your integration via an API call. This trigger is useful when you want to run your integration from your application code. For more information, see Configuring an API Trigger.

Cloud Pub/Sub Trigger

The Cloud Pub/Sub Trigger lets you run your integration based on the Google Cloud Pub/Sub middleware events. With this trigger, you can start an integration whenever a publisher writes a message to your chosen topic. For more information, see Configuring the Cloud Pub/Sub Trigger.

Schedule Trigger

The Schedule Trigger lets you run your integration periodically at specific time intervals. This trigger is useful when you want to run your integration automatically without any manual intervention. For example, you can consider using the Schedule Trigger for the following type of tasks:
  • Uploading files from one system to another system at regular intervals
  • Sending periodic email reminders
  • Syncing database at regular intervals
For more information, see Configuring a Schedule Trigger.

Salesforce Trigger

The Salesforce Trigger lets you listen to either Change Data Capture (CDC) or Enterprise Messaging Platform events. With this trigger, you can start your integration based on any of the CDC events (Create, Update, Delete, or Undelete) or the platform events in your Salesforce instance.

For more information about this trigger, see Configuring a Salesforce Trigger.

Adding multiple triggers in an integration

You can add more than one trigger in an integration where each trigger is associated with a different task. The integration starts from the trigger for which the event occurs. For example, consider your integration has two triggers where Trigger-1 is associated with Task-1, and Trigger-2 is associated with a downstream task Task-5. Now suppose an event triggers Trigger-2, the integration runs from Task-5 onwards.

If multiple triggers run at the same time, each trigger runs its copy of the integration. In the preceding example, if both Trigger-1 and Trigger-2 run simultaneously, Trigger-1 runs the integration from Task-1 onwards, and Trigger-2 runs a separate copy of the integration from Task-5 onwards. There is no overlap between the execution flows of the two integrations.

Testing integrations

You can test run your integration from the Integration designer. To test run an integration, open the integration in the Integration designer and then click Test. This displays the list of all the available triggers in your integration. Select the trigger from which you want to run your integration.

Before running the test, you should have the test data for the trigger(s) ready with you. If you select an API trigger, you are prompted to enter the test data for the integration's input variables. For the Cloud Pub/Sub and Salesforce triggers, you are prompted to enter test data for the trigger's output variables. The Schedule trigger doesn't require any test data.