0

We are planning to build some kind of a processing chain, when every item in an array is processed in separate scope of limits. Processing should happen strictly in a sequential way, i.e. second item should be processed after the first one. Processing is really heavy-weight, i.e. it eats a lot of SOQL/DML statements per each item.

We are thinking to model such behaviour by creating sort of events chain, i.e. fire platform event to process first item in an array. Then after processing it in event trigger, we want to fire another platform event right from there to start processing of next item in new scope of limits and so on.

But the question pops up here: Is it allowed to fire platform event from event trigger? Are there any limitations of how many platform events can be fired right from event trigger? We are interested specifically in platform events limits in event trigger context.

P.S. Batches and queueables are used in legacy implementation of such processing chain, but the problem is that it constantly hits limit per number of async calls per 24 hours - that's why we are looking into platform events now.

Any help would be appreciated.

1

Is it allowed to fire platform event from event trigger?

YES, no problem

Are there any limitations of how many platform events can be fired right from event trigger?

Each EventBus.publish method call is considered a DML statement, and DML limits apply. See doc. So, you could publish 10,000 events (as that is the limit for DML Rows)

Publishing limits (and, if using CometD subscribers, subscriber limits) can be found here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.