I have created a platform event with Publish Immediately behavior. It is very basic one. Once it is published, I want to upsert a custom object records. I am publishing it through developer console and subscribing through trigger (it is active) on after insert. In trigger, I am just printing the Trigger.New list. I can see in the logs, it is getting publish successfully but trigger is not getting invoked. Is there anything that I am doing wrong? Below are the details:
Platform Event:
Publishing through Developer Console:
List<Test__e> testvents = new List<Test__e>();
testvents.add(new Test__e(Name__c='Test'));
// Call method to publish events
List<Database.SaveResult> results = EventBus.publish(testvents);
// Inspect publishing result for each event
for (Database.SaveResult sr : results) {
if (sr.isSuccess()) {
System.debug('Successfully published event. '+sr);
} else {
for(Database.Error err : sr.getErrors()) {
System.debug('Error returned: ' +
err.getStatusCode() +
' - ' +
err.getMessage());
}
}
Apex Trigger:
Apex Debug:
EventBusSubscriber
to verify there are no errors