# Messaging and queuing

### **Monolithic applications and microservices**

![](https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FkvEWdiDwpi3sUzbN5dSz%2Fimage.png?alt=media\&token=536ab569-6436-40fc-81d4-f433b58b0a88)

Applications are made of multiple components. The components communicate with each other to transmit data, fulfill requests, and keep the application running.&#x20;

Suppose that you have an application with tightly coupled components. These components might include databases, servers, the user interface, business logic, and so on. This type of architecture can be considered a **monolithic application**.&#x20;

In this approach to application architecture, if a single component fails, other components fail, and possibly the entire application fails.

{% hint style="success" %}
To help maintain application availability when a single component fails, you can design your application through a **microservices** approach
{% endhint %}

![](https://604868167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQ9IWUW0VjkKLJPOeTIP3%2Fuploads%2FxR3HPunELHSg8P4dgwWC%2Fimage.png?alt=media\&token=a2160856-7fa2-4baf-80b0-0a969cc3959f)

In a microservices approach, application components are loosely coupled. In this case, if a single component fails, the other components continue to work because they are communicating with each other. The loose coupling prevents the entire application from failing.&#x20;

When designing applications on AWS, you can take a microservices approach with services and components that fulfill different functions. Two services facilitate 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. Using Amazon SNS topics, a publisher publishes messages to subscribers. This is similar to the coffee shop; the cashier provides coffee orders to the barista who makes the drinks.

In Amazon SNS, subscribers can be web servers, email addresses, AWS Lambda functions, or several other options.&#x20;

###

**Amazon Simple Queue Service (Amazon SQS)** is a message queuing service.&#x20;

Using Amazon SQS, you can send, store, and receive messages between software components, without losing messages or requiring other services to be available. In Amazon SQS, an application sends messages into a queue. A user or service retrieves a message from the queue, processes it, and then deletes it from the queue
