Amazon SQS for .NET Developers
Let's learn about Messaging in .NET Applications using Amazon SQS (Simple Queue Service).
Are you familiar with Queues?
Imagine a coffee shop line, where the people are serviced based on who came first. This is the same concept of Queues in Computer Engineering as well. Queues follow the FIFO style of processing, which is First In First Out.
A queue is just a holding entity that contains messages within it. Messages are usually in JSON format as you can see from the diagram above. As you can see from the diagram, System 1 will send messages to the Queue, which is being continuously polled and consumed by System 2.
Let’s make it simpler to understand, using a practical example related to Amazon SQS. Let’s say we have a PizzaOrderService service that can get orders from various clients like the actual store, mobile application, and other delivery applications. Once the order is received, this service would do some basic activities and publish a message to an Amazon SQS queue called pizza-order-queue, which will be polled by another service called, PizzaMakerService.
Essentially, the middleman that facilitates the communication between both these services is our queue, which in our case can also be the Amazon SQS. There will be multiple threads polling the queues. Once a thread receives the message, it disappears from the queue so that it’s only available for that specific thread. This happens over and over again. If the service is able to process the incoming message, it will be deleted from the queue.
In this demonstration, I built 2 ASP.NET Core WebAPIs. The first one produces events that are pushed into an Amazon SQS Queue and the second service consumes and processes the messages out of the SQS Queue.
TIP: You really need such a queue while building a scalable event-driven decoupled architecture. Find out why.
Here are the topics covered:
➡️What is Amazon SQS, or Amazon Simple Queue Service?
➡️Core Concepts: Queue, Message Processing, Pricing, Advantages of Amazon SQS, Types of Queues
➡️Creating an Amazon SQS via Console
➡️Sending Message to Amazon SQS Queue using .NET SDK
➡️Consuming Messages from Amazon SQS Queue using .NET SDK
➡️Postman Testing
➡️Use Cases of Amazon SQS
Read the entire article here: https://codewithmukesh.com/blog/amazon-sqs-for-dotnet-developers/