AWS Elastic Compute Cloud (EC2)

Messaging and Queuing

In a monolithic application, components are tightly coupled, and if a single component fails, other components fail, and possibly the entire application fails. In a microservices approach, application components are loosely coupled, and if one component fails, other components continue to work because they are communicating with each other. Loose coupling prevents the entire application from failing.

AWS provides 2 services facilitating application integration : Amazon Simple Notification Service (Amazon SNS) and Amazon Simple Queue Service (Amazon SQS). Amazon Simple Notification Service (Amazon SNS) is a publish/subscribe service. Amazon Simple Queue Service is a message queuing service.

Example of publish/subscriber service :

Messages sent by Coffee Shop

Instead of having a single newsletter for all topics, the coffee shop has broken it up into three separate newsletters. Each newsletter is devoted to a specific topic: coupons, coffee trivia, and new products. Subscribers will now receive updates immediately for only the specific topics to which they have subscribed. It is possible for subscribers to subscribe to a single topic or to multiple topics.

Example of queue service :

Coffee Shop orders in a queue

A message queuing service such as Amazon SQS enables messages between decoupled application complements. In this example a customer places an order with the cashier. The cashier puts the order into a queue, which is logically an order board. Even if the barista is out on a break or busy with another order, the cashier can continue placing new orders into the queue. Next, the barista checks the queue and retrieves the order. The barista prepares the drink and gives it to the customer. The barista then removes the completed order from the queue. While the barista is preparing the drink, the cashier is able to continue taking new orders and add them to the queue.

Previous Next

Leave a Reply

Your email address will not be published. Required fields are marked *