Nov 16, 20268 min read

RabbitMQ vs SQS: Which Message Queue to Use in 2026

How RabbitMQ and Amazon SQS compare on routing, delivery, retries, ordering, limits and operations, and how to get SNS and SQS fan-out from a topic declared in your code.

Illustration for RabbitMQ vs SQS: Which Message Queue to Use in 2026

RabbitMQ and Amazon SQS both move work from the code that creates it to the code that does it, which is why the choice comes up whenever a team adds background jobs or splits a service. RabbitMQ is a broker you run that routes messages through exchanges and pushes them to connected consumers, while SQS is a managed AWS queue that consumers poll, with no brokers, clusters or upgrades to own.

This guide compares the two on routing, delivery and retries, ordering, limits and operations, and shows how Encore gets SNS and SQS fan-out from a Pub/Sub topic declared in your code, which is infrastructure from code for messaging on AWS.

RabbitMQ vs SQS at a glance

Encore on AWSRabbitMQAmazon SQS
ModelTopics with subscriptions, on SNS and SQSExchanges route to queues, broker pushes to consumersQueues, consumers poll over HTTPS
Routing and fan-outOne topic, many subscriptionsDirect, topic, fanout and headers exchangesOne consumer group per queue, SNS for fan-out
AcknowledgementReturn nil from the handlerack or nack on the channelDeleteMessage before the visibility timeout ends
Retries and dead lettersRetryPolicy and a DLQ per subscriptionRequeue, delivery limit 20 on quorum queues, DLXVisibility timeout, redrive to a DLQ
OrderingOrderingAttribute on the topicPer queue, lost with requeues and competing consumersFIFO queues per message group
Message sizeSQS limits applyConfigurable, large messages hurt throughputUp to 1 MiB
Who runs itAWS, provisioned in your accountYou, or Amazon MQ for RabbitMQAWS
Local developmentencore run, in-processA local brokerAn emulator or a real queue

How does Encore handle queues on AWS?

Encore

Encore treats a queue as part of your application code. You declare a topic and its subscriptions in Go or TypeScript, encore run delivers messages in-process with no broker to install, and when you deploy to AWS Encore provisions an SNS topic with one SQS queue and dead-letter queue per subscription in your own account. Encore provisions an IAM role for the service.

Set up the app

Get started
brew install encoredev/tap/encore &&
encore app create
Copy

Run in your terminal to get started locally.

~
$ encore app create billing --example=hello-world$ cd billing && mkdir invoices

The invoices service publishes an InvoiceIssued event, and two subscriptions consume it independently: one sends the email with a custom retry policy, one posts to the ledger with the defaults.

// invoices/invoices.go package invoices import ( "context" "time" "encore.dev/beta/errs" "encore.dev/pubsub" "encore.dev/rlog" ) type InvoiceIssued struct { InvoiceID string `json:"invoice_id"` CustomerID string `json:"customer_id"` AmountCents int64 `json:"amount_cents"` Email string `json:"email"` } // On AWS this topic is an SNS topic, and each subscription below gets its own // SQS queue with a dead-letter queue. Locally, encore run handles it in-process. var Issued = pubsub.NewTopic[*InvoiceIssued]("invoice-issued", pubsub.TopicConfig{ DeliveryGuarantee: pubsub.AtLeastOnce, }) type IssueParams struct { InvoiceID string `json:"invoice_id"` CustomerID string `json:"customer_id"` AmountCents int64 `json:"amount_cents"` Email string `json:"email"` } type IssueResponse struct { MessageID string `json:"message_id"` } //encore:api public method=POST path=/invoices/issue func Issue(ctx context.Context, p *IssueParams) (*IssueResponse, error) { if p.InvoiceID == "" || p.Email == "" || p.AmountCents <= 0 { return nil, &errs.Error{Code: errs.InvalidArgument, Message: "invoice_id, email and a positive amount are required"} } id, err := Issued.Publish(ctx, &InvoiceIssued{ InvoiceID: p.InvoiceID, CustomerID: p.CustomerID, AmountCents: p.AmountCents, Email: p.Email, }) if err != nil { return nil, err } return &IssueResponse{MessageID: id}, nil } // Email: retried with backoff, then dead-lettered after 5 failed attempts. var _ = pubsub.NewSubscription(Issued, "send-invoice-email", pubsub.SubscriptionConfig[*InvoiceIssued]{ Handler: sendInvoiceEmail, AckDeadline: 60 * time.Second, MaxConcurrency: 20, RetryPolicy: &pubsub.RetryPolicy{ MinBackoff: 10 * time.Second, MaxBackoff: 5 * time.Minute, MaxRetries: 5, }, }) // Ledger: a second consumer of the same event, with its own queue and retries. var _ = pubsub.NewSubscription(Issued, "post-to-ledger", pubsub.SubscriptionConfig[*InvoiceIssued]{ Handler: postToLedger, }) func sendInvoiceEmail(ctx context.Context, e *InvoiceIssued) error { // Returning an error here makes Encore redeliver the message after the backoff. if err := sendEmail(ctx, e.Email, "Invoice "+e.InvoiceID); err != nil { return err } rlog.Info("invoice email sent", "invoice", e.InvoiceID, "to", e.Email) return nil } func postToLedger(ctx context.Context, e *InvoiceIssued) error { rlog.Info("invoice posted to ledger", "invoice", e.InvoiceID, "amount_cents", e.AmountCents) return nil } // sendEmail stands in for your email provider's client. func sendEmail(ctx context.Context, to, subject string) error { return nil }
~/billing
$ encore run$ curl -X POST localhost:4000/invoices/issue \ -d '{"invoice_id":"inv_1001","customer_id":"cus_7","amount_cents":4900,"email":"ana@example.com"}'{"message_id": "dbtbtb68qng7i0jujgqg"}

Both handlers log within a moment of the publish, each with its own trace, and a request without an invoice ID returns invalid_argument without publishing anything. The two subscriptions are the RabbitMQ fanout exchange in this model: each gets its own queue, so a slow ledger does not hold up email, and a failing email handler retries without the ledger seeing the message twice.

The Pub/Sub settings map onto SQS directly: in the Go runtime the subscription's AckDeadline becomes the queue's visibility timeout and the handler's context deadline, and a handler that returns an error has its message made visible again after the retry backoff, starting at MinBackoff and capped at MaxBackoff. After MaxRetries attempts the message moves to the subscription's dead-letter queue instead of looping, which is the job RabbitMQ's delivery limit and dead-letter exchange do. Delivery is at least once on both, so handlers that charge money or send email should be idempotent.

The topic, its subscriptions and the code that uses them live together, so an AI coding agent can add a consumer and its retry settings in one change that encore run exercises locally, and the SNS and SQS resources that change needs are created when it is deployed.

Best fit: teams on AWS that want fan-out, retries and dead-letter queues declared as topics and subscriptions in their code.

RabbitMQ

RabbitMQ routes each message through an exchange: direct exchanges match a routing key, topic exchanges match wildcard patterns like invoice.*.eu, fanout copies to every bound queue and headers exchanges match on message headers. Consumers hold long-lived connections and the broker pushes messages to them, with consumer prefetch limiting how many unacknowledged messages each consumer holds, which gives low latency and fine control over flow.

For durability, quorum queues replicate each queue across nodes using Raft and are the recommended default for replicated queues; classic queue mirroring was removed in RabbitMQ 4.0, and from 4.0 onward quorum queues also enforce a default delivery limit of 20, after which a message is dropped or sent to a dead-letter exchange if one is configured. Streams add an append-only log that consumers can replay, for cases where several readers need the same history.

Running RabbitMQ means operating a cluster, which needs an odd number of nodes, disk and memory alarms, upgrades and monitoring, and connection churn from serverless or autoscaled consumers puts load on the broker. Amazon MQ for RabbitMQ takes over provisioning and patching but you still size brokers and pay for them while idle, and RabbitMQ runs the same on any cloud or on-premises, which matters for teams that are not only on AWS.

Best fit: systems that need rich routing, push delivery with low latency or AMQP compatibility, and a team willing to run the brokers.

Amazon SQS

SQS has no brokers or connections to manage: producers call SendMessage, consumers call ReceiveMessage with long polling and delete each message after processing. A received message is hidden for the visibility timeout, 30 seconds by default and up to 12 hours, and reappears if it is not deleted in time, so a crashed consumer never loses work. Messages can be up to 1 MiB, are kept for 4 days by default and up to 14 days, and can be delayed by up to 15 minutes, according to the SQS message quotas.

Standard queues scale to nearly unlimited throughput with at-least-once delivery and best-effort ordering. FIFO queues order messages per message group and deduplicate within a 5-minute window, with 300 transactions per second per API action by default (3,000 messages per second with batches of 10) and far more in high throughput mode. A redrive policy moves a message to a dead-letter queue after it has been received maxReceiveCount times.

SQS has no routing of its own: each queue delivers a message to one consumer, so fan-out means an SNS topic with one queue per consumer, and SNS subscription filter policies take the place of topic or header exchanges. Billing is per request, with 1 million requests free each month and each 64 KB chunk of a payload counted as one request, according to the SQS pricing page, so cost tracks usage with nothing to pay while idle.

Best fit: AWS workloads that want durable work queues and background jobs with no servers to run and pay-per-use pricing.

How to choose

Pick RabbitMQ when you need its routing, push delivery and low latency, AMQP clients or a broker that runs the same outside AWS, and you have the people to operate a cluster. Pick SQS for work queues and background jobs on AWS where retries, dead-letter queues and scaling matter more than routing, and add SNS for fan-out. Pick Encore when you are on AWS and want that SNS and SQS setup declared as topics and subscriptions in your code, with retries and dead-letter queues created per subscription and the same code running locally with encore run. Encore provisions an IAM role for the service.

Frequently asked questions

What is the difference between RabbitMQ and SQS?

RabbitMQ is a message broker you run (or rent as Amazon MQ) that routes messages through exchanges to queues and pushes them to consumers over long-lived connections. Amazon SQS is a fully managed AWS queue that consumers poll over HTTPS, with visibility timeouts instead of connection-based acknowledgements and no brokers to operate.

Is SQS a replacement for RabbitMQ?

For work queues and background jobs, yes: SQS covers retries, delays, dead-letter queues and FIFO ordering without running brokers. It does not replace RabbitMQ's routing, so topic and header-based routing usually becomes SNS topics with subscription filters in front of SQS queues.

How do retries work in RabbitMQ vs SQS?

In RabbitMQ a consumer nacks or loses its connection and the message is requeued; since RabbitMQ 4.0 quorum queues dead-letter or drop a message after a default delivery limit of 20. In SQS a message that is not deleted reappears when its visibility timeout expires, and a redrive policy moves it to a dead-letter queue after maxReceiveCount receives.

How does Encore use SQS?

An Encore Pub/Sub topic declared in Go or TypeScript becomes an SNS topic on AWS, and each subscription becomes an SQS queue subscribed to it with its own dead-letter queue. The subscription's AckDeadline is used as the SQS visibility timeout and its RetryPolicy sets the backoff and the number of attempts.

Deploy to your cloud on AWS and Google Cloud
without managing infrastructure

Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.

~/orders — claude
Claude Code
Claude Code v2.1.180Opus 5.5~/orders