Need advice about which tool to choose?Ask the StackShare community!
Amazon SQS vs NServiceBus: What are the differences?
Introduction
In this article, we will discuss the key differences between Amazon Simple Queue Service (SQS) and NServiceBus. Both of these tools are widely used in distributed systems for messaging purposes. While SQS is a managed message queue service provided by Amazon Web Services (AWS), NServiceBus is an open-source messaging framework for .NET applications.
Message Persistence: One key difference between Amazon SQS and NServiceBus is their approach to message persistence. Amazon SQS stores messages in a highly durable manner, ensuring minimal message loss even in the event of failures. On the other hand, NServiceBus relies on the underlying transport mechanism, such as RabbitMQ or Azure Service Bus, for message persistence.
Message Ordering: Another significant difference is the guarantee of message ordering. Amazon SQS provides strict ordering of messages within a single message group, ensuring that the order in which messages are sent is the order in which they are received. NServiceBus, on the other hand, does not provide strict ordering guarantees by default. It allows for concurrent processing of messages, which may result in a different order of execution.
Scalability: Both SQS and NServiceBus support scalability, but they differ in how they handle it. SQS is a fully managed service that automatically scales based on the workload, providing high throughput and elasticity without any manual intervention. NServiceBus, being a framework, requires explicit scaling and configuration based on the underlying transport mechanism.
Message Routing: When it comes to message routing, NServiceBus provides a rich set of features for routing messages to specific endpoints or subscribers based on various criteria. It supports publish-subscribe patterns, message routing based on content, and dynamic routing. Amazon SQS, on the other hand, has limited routing capabilities and primarily relies on the ability to subscribe to specific queues.
Protocol Support: NServiceBus supports various messaging protocols such as AMQP, MSMQ, Azure Service Bus, RabbitMQ, and more. This allows developers to choose the transport mechanism that best suits their needs and existing infrastructure. In contrast, Amazon SQS uses its proprietary protocol and is tightly integrated with the AWS ecosystem.
Pricing: Pricing is another key difference between SQS and NServiceBus. Amazon SQS follows a pay-per-use model, where you are charged based on the number of requests and the amount of data transferred. NServiceBus, being an open-source framework, does not have any direct costs associated with it. However, you may need to consider the costs of the underlying transport mechanism used with NServiceBus.
In summary, Amazon SQS and NServiceBus differ in terms of message persistence, message ordering, scalability, message routing, protocol support, and pricing. The choice between these two tools depends on the specific requirements and constraints of your distributed system.
I want to schedule a message. Amazon SQS provides a delay of 15 minutes, but I want it in some hours.
Example: Let's say a Message1 is consumed by a consumer A but somehow it failed inside the consumer. I would want to put it in a queue and retry after 4hrs. Can I do this in Amazon MQ? I have seen in some Amazon MQ videos saying scheduling messages can be done. But, I'm not sure how.
Mithiridi, I believe you are talking about two different things. 1. If you need to process messages with delays of more 15m or at specific times, it's not a good idea to use queues, independently of tool SQM, Rabbit or Amazon MQ. you should considerer another approach using a scheduled job. 2. For dead queues and policy retries RabbitMQ, for example, doesn't support your use case. https://medium.com/@kiennguyen88/rabbitmq-delay-retry-schedule-with-dead-letter-exchange-31fb25a440fc I'm not sure if that is possible SNS/SQS support, they have a maximum delay for delivery (maxDelayTarget) in seconds but it's not clear the number. You can check this out: https://docs.aws.amazon.com/sns/latest/dg/sns-message-delivery-retries.html
Pros of Amazon SQS
- Easy to use, reliable62
- Low cost40
- Simple28
- Doesn't need to maintain it14
- It is Serverless8
- Has a max message size (currently 256K)4
- Triggers Lambda3
- Easy to configure with Terraform3
- Delayed delivery upto 15 mins only3
- Delayed delivery upto 12 hours3
- JMS compliant1
- Support for retry and dead letter queue1
- D1
Pros of NServiceBus
- Not as good as alternatives, good job security1
- Brings on-prem issues to the cloud1
Sign up to add or upvote prosMake informed product decisions
Cons of Amazon SQS
- Has a max message size (currently 256K)2
- Proprietary2
- Difficult to configure2
- Has a maximum 15 minutes of delayed messages only1