I find the concept of transactions really useful when working with databases because obviously it allows you to rollback changes if one step of a modification goes awry.
Is there some way I can extend the same principle across multiple services? Say I have the following example of someone uploading something to a website (not contrived by the way, I'm dealing with something similar now):
// Store data in an object store $object->putToS3(); // Add to ElasticSearch node Search::indexObject($object); // Remove local files $object->deleteLocalFiles(); // Increment some Redis counter Redis::hmset(...); // Add to database $object->save();
Is there some standardized solution on how I can undo all of these actions if any one fails, to keep my data in the correct state? I don't have much knowledge about this.
What I do know however is that it would suck to have something added to your database that doesn't exist in your storage solution or in your Redis store.
Has anyone dealt with anything similar?