Choreography - Modern Application Development on AWS


When a new customer creates an account on your website, they might need to save their profile information, receive a welcome email, and get credited with some initial points to use on the site. All of these activities are implemented by different services.

There are two implementation methods that you can consider to execute these tasks between your microservices: the orchestration pattern and the choreography pattern. With the orchestration pattern, similar to the relationship in a symphony between a conductor and an orchestra, there is a central service that issues commands to other services and makes sure that the entire process is completed. With the choreography pattern, just as dancers move independently after they have learned the choreography of their dance, each service can execute independently in response to a particular event.

When you use the choreography pattern, an initial event that contains all the required information can be saved in a single message, and concludes an initial transaction. Other services can then retrieve that message asynchronously and complete their respective tasks. With this architecture, services are loosely coupled and do not have a direct impact on each other. The asynchronous relationship between saving and retrieving messages also provides scalability and reliability benefits.

Figure 14 – Example of the choreography pattern

To implement the choreography pattern in the AWS Cloud, you can use Amazon Kinesis and AWS Lambda, or, depending on your requirements, use a combination of Amazon Simple Notification Service (Amazon SNS), Amazon Simple Queue Service (Amazon SQS), and AWS Lambda.

Figure 15 – Example of the choreography pattern using Amazon SNS, Amazon SQS, and AWS  Lambda