We have a platform event, let's call it
Event__e, with one field called
We provide a global apex class with an invocable method on it, let's call it
EventPublisher.publish that accepts a list of "names" (strings) and creates an
Event__e instance per "name", storing the supplied "name" in the
Identity__c field and then publishes the events on the event bus using:
We then have a trigger subscribed to this event that takes the platform events and processes them.
This invocable method is itself called from a Process Builder, passing in just a single name.
Our event used to have the publish behaviour of "Publish Immediately" and this worked (the events were received by the trigger-based subscriber), but we were not getting quite the behaviour we wanted - the data the process builder was manipulating was not available in the database when the trigger-based subscriber was processing the events.
We thus changed the
Event__e publish behaviour to "Publish After Commit".
Now the process builder never causes the trigger-based subscriber to be called. Any idea what's going wrong?