raine
raine

Reputation: 857

Async Plugin Execution Order

If I modify the same record three times, and I have an async plugin listening to the Update message, will the updates be ordered?

I'd expect the updates to be ordered, even if executed asynchronously (properly queued for later execution). If this is the case, I hope the same holds for create and delete messates.

Thanks in advance.

Upvotes: 3

Views: 3564

Answers (3)

Muhammad Talha
Muhammad Talha

Reputation: 1

Following diagram shows how the execution order work for plugins & workflows. Importance of execution order

Conclusion: Normally workflows’ default execution order value is “0” & user cannot be defined that value. If user set execution order to “1” in plugin step then real-time workflows will be triggered before the plugins.

If user needs to execute plugin before the real-time workflow then user should have to change execution order to “0” in plugin step.

Upvotes: 0

Guido Preite
Guido Preite

Reputation: 15138

With asynchronous plugins the order of execution is not guaranteed, if you want to make the plugins be executed respecting the queue you need to use the DependencyToken attribute.

You can find an article here:

Dependency and Execution Order in Asynchronous Operations

Upvotes: 4

Konrad Viltersten
Konrad Viltersten

Reputation: 39308

In addition to @GuidosPreite I can say that of the tests I ran a while ago, the plugins will execute in the order you'd expect them to.

However, just as he says, don't bet your house on it. If you're unlucky, an early thread can be executed with more delay than an earlier. And provided Murphy's law, it will.

Moreover, the behavior may be different on different roll-ups, servers, days of the week etc. So in short: yes but no.

Upvotes: 2

Related Questions