0

I am planning to write an Asynchronous Trigger but I am not any documentation, if Async Trigger can run parallelly with other async process or it's added in queue based on availaible resources.

Thank you

1

I think the only real indicator we have is this statement:

Unlike triggers on standard or custom objects, triggers on platform events don’t execute in the same Apex transaction as the one that published the event. The trigger runs asynchronously in its own process. As a result, there can be a delay between when an event is published and when the trigger processes the event.

But this doesn't tell us if these triggers share the same queue as Scheduleable/Queueable/future/Batchable calls, or if they're a separate queue. I'm pretty sure that asynchronous code would have a lower priority than these events, however, given that these events are still under synchronous limits.

Synchronous Governor Limits

When governor limits are different for synchronous and asynchronous Apex, the synchronous limits apply to platform event triggers. Asynchronous limits are for long-lived processes, such as Batch Apex and future methods. Synchronous limits are for short-lived processes that execute quickly. Although platform event triggers run asynchronously, they’re short-lived processes that execute in batches rather quickly.

This restriction on execution time means that they're expecting a lot of these events, and that they must be processed quickly. This would suggest a higher priority than the background tasks that have a lower urgency.

So, it's probably safe to say that, under heavy load, these triggers are likely to execute sooner than non-priority jobs from Batchable, Queuable, and future.

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.