Events and Tasks
Events are delivered to extensions as Tasks. Each extension incorporates its own tasks queue for specifying events that should be processed.
There are three different categories of Tasks:
- Background: These tasks are generated when a change to a domain object occurs (e.g.,
a
purchase requestis created or has beenapproved); - Interactive: Such tasks are created by a web call (for example a
draft purchase request validationor aproduct action); - Scheduled: These tasks are created and triggered according to a schedule that is configured for your extension.
Note that the way your extension processes a tasks queue depends on a task category and your extension type.
Background tasks
The following outlines rules that apply to background tasks:
- For
Fulfillment Automationextensions: an event generates a task only in case its associated domain object is related to a Product that is selected for your extension. - For
Hub Integrationextensions: an event generates a task only if a domain object is related to a Hub that is selected for your extension. - For
Multi Account Installationextensions: an event generates a task only in case a domain object is visible to an account that installed such an extension. - In case a
taskfor a given domain object is in a queue (i.e., it has thescheduledstatus) and this object is changed, additional tasks will not be created. - If a
taskis rescheduled by the extension (i.e., your extension will process a task after a few seconds), this task will be delivered once this delay is expired.
Interactive tasks
Events that generate interactive tasks are only available for Fulfillment Automation extensions.
Due to their nature, they are delivered immediately.
Scheduled tasks
When a schedule configured for an extension is triggered, it generates a task that is related to this schedule. In case a task for the same schedule is in a queue and this schedule is triggered again, additional tasks will not be created.
Most of domain objects on CloudBlue Connect will generate an event every time they change.
Events subscription
An extension can receive events generated by a certain type of domain object via a list of object states. Therefore, once your selected object switches to your specified state, your extension can receive this event and perform subsequent operaions.
For example, an extension can be assigned to receive only those events when purchase requests are switched to the approved state.