Newer Version Available

This content describes an older version of this product. View Latest

Example: Publish Events with a Callback Instance

To invoke the callback, perform an EventBus.publish call by passing it an instance of the FailureCallback class. You can publish one event or a batch of events with the callback.

This example publishes two event messages. This example requires a platform event, Order Event, to be defined with a Text(18) field of Order Id. To view debug logs for the FailureCallback class, make sure that you set up user trace flags for the Automated Process user. For more information, see Callback Running User and Debug Logs. In this case, if all publishing is successful, the onFailure() method isn’t invoked.