Skip to main content

Messaging and Queuing in AWS



Amazon Web Services (AWS) offers a suite of messaging and queuing services that cater to different use cases, from simple message queuing to real-time streaming data. Here's a brief overview of these services and their use cases:

Amazon SQS (Simple Queue Service):

  • Type: Message queuing service.

  • Use Cases: Decoupling application components, distributing tasks among worker nodes, buffering requests, and handling spikes in load.

  • Features:

    • Standard Queues: Nearly unlimited throughput, best-effort ordering, and at least once delivery.

    • FIFO (First-In-First-Out) Queues: Exactly-once processing, guaranteed order, and limited throughput.

  • Integration: Easily integrated with AWS Lambda, EC2, ECS, and other AWS services.

  • Example 1: Fulfilling an order

Suppose the coffee shop has an ordering process in which a cashier takes orders, and a barista makes the orders. Think of the cashier and the barista as two separate components of an application.

First, the cashier takes an order and writes it down on paper. Next, the cashier delivers the paper to the barista. Finally, the barista makes the drink and gives it to the customer.

When the next order comes in, the process repeats. This process runs smoothly as long as the cashier and barista coordinate.

What might happen if the cashier took an order and went to deliver it to the barista, but the barista was out on a break or busy with another order? The cashier would need to wait until the barista is ready to accept the order. This would cause delays in the ordering process and require customers to wait longer to receive their orders.

As the coffee shop has become more popular and the ordering line is moving more slowly, the owners notice that the current ordering process is time-consuming and inefficient. They decide to try a different approach that uses a queue.

  • Example 2: Orders in a queue

    Recall that the cashier and the barista are two separate components of an application. A message queuing service like Amazon SQS lets messages between decoupled application complements.

    In this example, the first step in the process remains the same as before: a customer places an order with the cashier.

    The cashier puts the order into a queue. You can think of this as an order board that serves as a buffer between the cashier and the barista. 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 can continue taking new orders and add them to the queue.

    Amazon SNS (Simple Notification Service):

    • Type: Pub/Sub messaging service.

    • Use Cases: Sending alerts, notifications, and broadcasting messages to a distributed set of recipients.

    • Features:

      • Supports various endpoints like email, SMS, application endpoints, and more.

      • Integrates with SQS, allowing for fan-out architecture.

    • To review two examples of how to use Amazon SNS:

      • Publishing updates from a single topic

    Suppose the coffee shop has a single newsletter that includes updates from all areas of its business. It includes topics such as coupons, coffee trivia, and new products. All of these topics are grouped because this is a single newsletter. All customers who subscribe to the newsletter receive updates about coupons, coffee trivia, and new products.

    After a while, some customers express that they prefer to receive separate newsletters for only the topics that interest them. The coffee shop owners decided to try this approach.

    • Publishing updates from multiple topics

      Instead of having a single newsletter for all topics, the coffee shop has broken it 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 they have subscribed to.

      Subscribers can subscribe to a single topic or multiple topics. For example, the first customer subscribes to only the coupons topic, and the second subscriber subscribes to only the coffee trivia topic. The third customer subscribes to both the coffee trivia and new product topics.

  • Amazon Kinesis:

    • Type: Streaming data platform.

    • Kinesis Streams: Collect and process real-time data. Used for log and event data streaming.

    • Kinesis Firehose: Easily load massive volumes of streaming data into AWS data stores.

    • Kinesis Video Streams: Stream video from connected devices.

    • Kinesis Data Analytics: Analyze streaming data with SQL or Apache Flink.

    • Use Cases: Real-time analytics, dashboarding, telemetry, monitoring, etc.

  • Amazon SES (Simple Email Service):

    • Type: Email sending service.

    • Use Cases: Sending transactional emails, marketing messages, and other email-based communication.

  • Amazon MQ:

    • Type: Managed message broker service.

    • Features: Supports industry-standard APIs and protocols like JMS, NMS, AMQP, STOMP, MQTT, and WebSocket.

    • Use Cases: Migrating on-premises messaging systems to the cloud, integrating with commercial and open-source message brokers.

  • AWS Step Functions:

    • Type: Serverless workflow service.

    • Use Cases: Coordinating multiple AWS services into serverless workflows.

    • Features: Visual workflow designer, error handling, parallel and branching steps.

  • AWS EventBridge:

    • Type: Serverless event bus.

    • Use Cases: Building event-driven applications, integrating software (SaaS) applications with AWS services.

    • Features: Routes events from AWS services and third-party sources to targets like AWS Lambda, Kinesis, etc.

When choosing among these services, it's crucial to consider the nature of your application, the kind of data you're dealing with, the required latency, throughput, and the overall architectural fit. Some solutions might be better suited for event-driven architectures, while others are ideal for batch processing or real-time streaming.

Comments

Popular posts from this blog

Run command

"Use Run Command make life easy" Sometime we use many run command in our windows base computer. Run command is very useful for easy work. There are some "run command",

Cloud computing

  Cloud computing is a technology model that enables access to a shared pool of computing resources and services over the Internet. Instead of owning and maintaining physical servers and data centers, organizations can use cloud computing services provided by cloud service providers. These services include computing power, storage, databases, networking, software, and more. Cloud computing services can be categorized into several main models: Infrastructure as a Service (IaaS): IaaS provides virtualized computing resources over the Internet. Users can rent virtual machines, storage, and networking components, allowing them to run and manage their operating systems and applications. Platform as a Service (PaaS): PaaS offers a platform that includes the underlying infrastructure, development tools, and services to build, deploy, and manage applications. Users focus on coding and application development while the platform handles the underlying infrastructure. Software as a Service ...

AWS Free Tier

The AWS Free Tier is designed to give you hands-on experience with a range of Amazon Web Services (AWS) products and services without charging you for usage up to a specific limit. This tier primarily benefits new AWS customers, allowing them to try different AWS services and gain practical experience before committing to more extensive usage. The Free Tier includes offers that are available for 12 months following your AWS sign-up date, as well as offers that are always free. Here are the main components of the AWS Free Tier: 12-Months Free: These offers are available to new AWS customers and are valid for 12 months following your AWS sign-up date. After the 12-month free usage term, you pay standard, pay-as-you-go service rates. Always Free: These offers do not expire and are available to all AWS customers. They provide limited access to a range of AWS services for free forever. However, the usage limits reset monthly. Trials: Short-term trial offers start when you activate a part...