Implementing Distributed Transactions with Sagas

Learn to implement distributed transactions using Sagas by updating packages and creating an orchestrator.

To organize the order creation process as a saga, we will be introducing additional functionality in the form of an SEC. These are the items we will be building or modifying to accomplish this task:

  • We will update the ddd and am packages so that they include the new Command and Reply message types.

  • We will create a new sec package that will be the home for an orchestrator and saga definitions and implementations.

Now, let’s dive into the existing packages to add those new types of messages.

Adding support for the command and reply messages

The command and reply additions to the ddd package are nearly exact copies of the event definitions and implementations that we can expand on later. Here are the interfaces and implementations for reply:

Get hands-on with 1400+ tech skills courses.