Skip Navigation
Expand
There are two types of execution for Object Event Handlers
Answer ID 6604   |   Last Review Date 08/04/2021

What is the difference between asynchronous and synchronous execution of Object Event Handlers in the custom process?

Environment:

Process Designer, Custom Process Model (CPM) / Service Process Model (SPM)
All product versions

Resolution:

Synchronous execution of an Object Event Handler has a strict time limit of 5 seconds. It is intended for processes that are executed without interruption from start to finish. Synchronous execution of an Object Event handler requires the code executing it to wait until the handler is completed to continue execution.

Asynchronous execution of an Object Event Handler has a time limit of 157 seconds of processing time, execution is controlled by a queuing system. If there is a failure to execute the first time, the process can be repeated up to four times. Retry intervals increase over time (from 90,450, 3150, and 34,650 seconds respectively). The goal is to ensure that the resources needed for execution are available.

Also, asynchronous execution is intended for event handlers that do not need to execute immediately. An example that may use asynchronous execution could be an integration that updates contact information in an external database when a contact is created in Oracle B2C Service. The site utility for the queue that processes asynchronous CPMs will only hold a maximum of three database connections at a time. While the use of this product feature allows for a high volume of functionality to process without overloading the site database, this is part of the design of this product feature that results in no guarantee that the queue will always be current (and not have a backlog).

To set the event handler to execute asynchronously, select the Execute Asynchronously check box and/or name the handler with the async keyword. This needs to be done before a CPM customization is first saved, since this aspect of the configuration is non-editable for existing CPM customizations. For details on how to delete a CPM customization see

Answer ID 7883: Delete Custom Process Model Script (CPM)

For more information, refer to the following:

Answer ID 9453: Two second guideline for synchronous CPMs

Answer ID 11934:  Alternatives to using CPM customizations for event-driven functionality that needs to happen immediately

Answer ID 6907: Limitations of synchronous object event handlers when attached to the answer object.