Newer Version Available

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

Subscribe to Platform Event Messages with Processes

Processes can subscribe to platform events and receive event messages published through Apex, APIs, flows, or other processes. Processes provide an autosubscription mechanism.

To subscribe a process to a platform event, build the process to start when it receives a platform event message. In the process’s trigger, associate the process with a platform event and an object.

Example

This process starts when it receives a Printer Status event message. When it starts, the process looks for an Asset record whose serial number matches the serial number in the event message. Sample process trigger

If flow interviews and active processes are subscribed to the same platform event, we can’t guarantee which one processes the event message first.

A process evaluates platform event messages in the order they’re received. The order of event messages is based on the event replay ID. A process can receive a batch of event messages at once. The order is preserved within each batch. The event messages in a batch can originate from multiple publishers.

Unlike record-change processes, event processes don’t execute in the same Apex transaction as whatever published the event message. The process runs asynchronously under the Automated Process entity. As a result, there can be a delay between when an event message is published and when the process evaluates the event message. Automated Process creates the debug logs corresponding to the process execution, but the actions are performed on behalf of the user who published the event. System fields, such as CreatedById and LastModifiedById, reference the user who published the event message.

Event processes and record-change processes have similar limitations. For example, they’re both subject to Apex governor limits.