Reputation: 459
I came across an interview question for which I got different answers from friends and peers so I thought I'd ask here.
We generally use the plugin ranking for defining the order in which different plugins execute in order to overcome the dependency issues.
Question
If an entity has multiple plugins (be it from different dlls or same dll) registered on the same event and same stage and all of them have the Rank/Order as 1 - what is the order in which they get triggered?
Do they all execute in parallel? Does it depend on which plugin got registered first etc ? Please point me to any MSDN reference if you can.
Thanks in advance.
Upvotes: 3
Views: 8011
Reputation: 1215
Updated for the current implementation of the Plugin Registration tool.
Upvotes: 0
Reputation: 258
The SdkMessageProcessingStep.SdkMessageFilterId is what manages the order in which plug-ins are executed when all other factors are equal.
Compilation date was documented years ago. IDK if it was true then, but it is not now.
Upvotes: 3
Reputation: 22846
As a good practice (also a good interview answer), it’s not safe to rely on CRM Product’s fallback plan of compilation date logic. Use the execution order wisely based on our requirement.
If this CRM logic changes tomorrow or Dev team added a new plugin to the same assembly/message/stage, which has to execute on top or in between other plugins then the dependency issues rises. So design well.
Upvotes: 1
Reputation: 2123
Hi please find below copied from MSDN
,
Execution Order:
Specifies the order, also known as rank, that plug-ins are executed within a
pipeline stage. Plug-ins registered with an order value of 1 are executed
first, followed by plug-ins registered with an order of 2, and so on. However,
if there is more than one plug-in in a stage with the same order value, then
the plug-in with the earliest compilation date is called first.
Upvotes: 8