How to achieve transaction in a network scenario?

100 Views Asked by At

Our business process is composed of several web service calls, including both Read and Write. Each of them could fail for some reason. But it is critical for our process to be transactional ? i.e. If any failure happens in the middle of the process, we want it rollback all previous steps. How to achieve it in a network scenario? Thanks.

1

There are 1 best solutions below

0
On

Create a "remote command" entity called something like new_RemoteCommand. Create a plugin registered on the Pre step for Create. Put your all of your code in this plugin. All web service calls within the plugin are run inside the main database transaction, so if one fails they would all roll back and the whole Create would fail.

Now the calling code just needs to create a new_RemoteCommand, and all your code should be executed inside of a transaction. You could even pass "parameters" to your plugin by adding custom fields.

Hope that helps!