Short answer: for a small SaaS that must retry failed jobs in the EU and US, the lowest defensible cost is the option whose total operating burden still preserves delayed delivery, a dead-letter queue, idempotent effects, and an auditable replay path. Per-message pricing cannot establish that result on its own.
A queue delivery is an attempt to perform work, not proof that work happened once. That distinction matters most in systems with payments, ledgers, entitlement changes, or notifications that must later be explained to a customer or auditor. A worker can commit a database transaction and lose its acknowledgement; the message may then return. A worker can lose a lease before committing; a different worker may receive the same job. The durable record must decide the business outcome.
The cost model begins with this constraint because a cheap transport that cannot be recovered or reconciled is merely moving cost to an incident. Keep the accounting honest.
Do not optimize the first invoice.
How should a small SaaS compare SQS, RabbitMQ, and managed queues for EU/US delayed retry?
Start by separating the queue category from the business contract. SQS is a managed queue within an AWS deployment boundary. RabbitMQ can be operated by the application team or supplied under a hosting contract, and its topology can be deliberately controlled. A managed queue generally shifts more infrastructure operation into a provider contract. Google describes Pub/Sub as asynchronous and scalable messaging, but those broad properties do not settle retention, regional placement, retry policy, or billing for a particular workload.
For a fair comparison, collect two weeks of representative measurements before choosing: arrivals by minute, payload-size distribution, worker duration, retry causes, desired delay intervals, dead-letter volume, retention period, regional transfer, and human time spent on upgrades, recovery exercises, and on-call. Then price sends, receives, empty polls where relevant, payload units, storage, network transfer, support, and the operational work that a self-operated deployment keeps on the team. Idle capacity and burst shape can reverse an apparent winner. Your mileage may vary because a queue that is inexpensive at steady traffic can have a different cost profile under long retention or irregular spikes. Put the measurements beside a recovery exercise, too: pause consumers, create a known set of retry-eligible records, restore consumption, and account for every record through either a single committed effect or a documented review state. If the calculation excludes the people who maintain alerts, validate backups, approve a replay, and answer why a customer-visible action happened twice, it is not a total-cost calculation; it is a partial quote that cannot guide an architectural decision.
| Category | Cost to count | Boundary to own | Unsuitable condition |
|---|---|---|---|
| Cloud-managed queue | Requests, payload units, retention, transfer, and support | Service policy, application adapter, and recovery procedure | A required routing model or deployment boundary cannot be met |
| Self-operated broker | Compute, disks, backups, upgrades, monitoring, and on-call | Broker capacity, topology, patching, and restore drills | No team can continuously own those operational duties |
| Hosted broker | Plan limits, transfer, support, and integration work | The contract split between operator and customer | Contractual region, retention, or control requirements are absent |
This is not a ranking. It is a way to expose which costs and obligations move when the transport changes. A self-operated broker can be appropriate where its routing control and established operating practice are requirements; a managed service can be appropriate where the service contract aligns with the deployment and the team wants fewer broker duties. The catch is that nominal request price leaves out the recovery responsibility that surfaces after the first ambiguous delivery.
The invariant belongs in the database, not in the queue
The useful invariant is narrow: a job can be delivered and attempted more than once, while its business effect commits once for one immutable idempotency key. Store that key with the business mutation in the same transaction. A later delivery finds the previously committed key, records a duplicate attempt, and performs no second business mutation. The queue's acknowledgement happens after the commit, which makes a lost acknowledgement survivable instead of mysterious.
This is an exactly-once outcome at the ledger boundary, not a claim about exactly-once transport. It also gives reconciliation something concrete to compare: accepted job identifiers, committed idempotency keys, and attempt events. Queue depth alone is not evidence of correctness.
That is the test.
The queue adapter should own leases, acknowledgement, delay mechanics, and dead-letter movement. The processor should own validation and the atomic business effect. The audit store should record the decision before a job is rescheduled or moved for review. This division prevents transport-specific behavior from leaking into financial logic and makes a later queue migration testable against the same contract.
package jobs import ( "context" "time" ) type Job struct { ID string Region string Attempt int Body []byte } type Queue interface { Ack(context.Context, Job) error RetryAt(context.Context, Job, time.Time) error DeadLetter(context.Context, Job, string) error } type Ledger interface { Apply(context.Context, string, []byte) (alreadyApplied bool, err error) } type Audit interface { Record(context.Context, string, string, int, time.Time) error } func Handle(ctx context.Context, q Queue, ledger Ledger, audit Audit, job Job, now time.Time) error { alreadyApplied, err := ledger.Apply(ctx, job.ID, job.Body) if err == nil { if err := audit.Record(ctx, job.ID, "applied", job.Attempt, now); err != nil { return err } _ = alreadyApplied return q.Ack(ctx, job) } if job.Attempt >= 6 { if err := audit.Record(ctx, job.ID, "dead-lettered", job.Attempt, now); err != nil { return err } return q.DeadLetter(ctx, job, "retry budget exhausted") } next := now.Add(time.Duration(1<<min(job.Attempt, 6)) * time.Second) if err := audit.Record(ctx, job.ID, "retry-scheduled", job.Attempt, next); err != nil { return err } return q.RetryAt(ctx, job, next) } The example deliberately omits a transport implementation. In production, classify permanent input failures before spending retry budget, cap total elapsed retry time, apply bounded jitter, renew a lease for work that can outlive it, and restrict the payload to identifiers and data that the worker needs. For a signed callback, RFC 2104 specifies HMAC as a keyed-hashing construction for message authentication. It does not choose a canonical form for application data, rotate keys, or set a replay window; those policies must be explicit and tested.
Delayed retry is a scheduling policy, and dead letters are evidence
Retries should answer a question: did a transient condition make this attempt unsafe to complete now, or is the input permanently unsuitable? A timeout, a dependency limit, and an invalid request do not deserve the same schedule. A bounded exponential delay is often a reasonable starting point, provided the total retry window has a limit and jitter prevents many workers from retrying together. The exact intervals are policy, so document their reason rather than treating them as queue defaults.
Dead-lettering is not successful completion. It is a controlled handoff to investigation, with enough context to establish what was attempted and why policy stopped retrying. Record the job identifier, region, first-seen time, attempt count, error class, correlation identifier, next eligible time where relevant, and the actor who initiates a replay. Keep sensitive request material out of a broadly readable queue payload and audit store.
The operational test that matters is intentionally awkward: terminate a worker after the ledger commit but before acknowledgement, resume consumption, and reconcile the resulting duplicate delivery against one committed business effect and two auditable attempts. Repeat the test for termination before commit, exhausted retry budget, clock skew, an expired lease, and replaying the same dead-letter batch twice. These tests measure the boundary that users and compliance reviewers will inspect.
For EU and US workloads, treat each region as an independent data-handling and recovery boundary. Separate credentials, access policy, logs, and replay authority reduce accidental cross-region coupling; the job schema and conformance tests can still be shared. Do not copy opaque broker state simply to recover work. Rebuild an approved, bounded replay batch from durable business records, retain its audit identifier, and reconcile the result within its region. Queue placement alone does not determine residency, retention, deletion, or access obligations, so current legal and provider terms need their own review.
Where the cheapest-looking design stops fitting
An application with no owner for backup restores, upgrades, capacity planning, and recovery drills should not treat a self-operated broker as a cost-saving shortcut. The compute bill is visible; the operating obligation arrives later. Conversely, a team with established broker practice or a required application-controlled routing topology should not discard that capability merely to reduce a service line item. Those are different risk allocations.
A single queue spanning regional responsibilities also becomes difficult to audit when it combines latency, access, and replay authority in one operational surface. Separate regional queues add configuration and dashboard work, which should be managed through versioned policy and the same adapter conformance suite. The trade-off is real.
Avoid a queue-first migration. First define the job envelope, idempotency-key format, error taxonomy, retry budget, dead-letter record, and reconciliation query behind a generic adapter. Run duplicate-delivery and replay tests against the old and new adapters, dual-observe their attempt and audit events, move one low-risk job class, then expand only after the reconciliations agree. Keep rollback focused on routing new work; already accepted work should remain traceable to the adapter and audit record that handled it.
The economical result is the system whose delivery ambiguity can be reconciled without inventing a second business effect. Review that decision when load shape, regional obligations, routing needs, or the team's operating capacity changes.
