I am currently trying to troubleshoot a Platform Events implementation that seems to behave inconsistently. Here's the current architecture:
I have an Apex Trigger on the
Account SObject, where I publish some Platform events. I also have a trigger on that Platform Event SObject, responsible of creating records in Salesforce. I enabled Debug Logs for the
Automated Process, subscribed to the Platform Event using Workbench and started creating some
Accounts to generate some Platform Events.
2 Contacts to be created for each
Account created (due to the Platform Event Apex Trigger)
While looking at the logs generated following the creation of an
Account, every request is generating a Platform Event record successfully. However, it seems like the business logic associated to the Platform Event is executed some times - I can assess this by looking at the output data in Salesforce + missing
Automated Process logs in Salesforce for some of the Platform Events created. I was able to assess that ALL the Events are generated successfully subscribing as well via Workbench and receiving every Platform Events I'd expect.
- Is there a reason why Workbench would get notified of an event, but not an Apex Trigger on the exact same Platform Events?
- Is there a chance they are stuck in a queue that is due to be executed at a future time?
- If the previous is possible, is it possible to replay the events that Salesforce skipped?