I've developed a CRM plugin that communicates with an enterprise service bus (ESB). For some specified entities, on create/update/associate/disassociate events, the plugin sends data flow to ESB.
I have some issues on the disassociate event, when the plugin is executed multiple times at a time, it seems that the last execution takes the last state of the entity, as it is not considering the last disassociation.
I know that a CRM plugin is not instanced every time it runs so I believe that the last execution is in concurrency with the previous as I make a RETRIEVE call on the target during the plugin process.
How can I resolve that issue ? Is there a lock or something that I can use ?
*This post is locked for comments