Working with Callbacks
Asynchronous callbacks are functions passed as arguments to the backend-executed operations. They're employed in asynchronous programming to manage the outcome or completion of an asynchronous operation. Typically, once the background code execution finishes, the async (or Asynchronous) callback function is triggered. The callback function carries out additional actions or processes the returned data after it is triggered.
In OS1, multiple services such as Participant, Entity, and Container. follow async architecture because of which the apps don't get an instant response from these services. Implementing callbacks is essential for the apps to get notified:
- When the operation is complete.
- Necessary changes are made. For example, if the value of an attribute is updated then the apps could be notified about the update.
For every async API developer can add the callback URL as shown below:
Provided below is the illustration of how a callback response will look for the CreateDispatchEvent.