POLAKO / Blog

Architecture · 23.11.2026

Message queues: why ticket checkout and chat shouldn't hang on a single call

SNS, SQS and similar message queues split a system into parts that don't fail together. And when something goes wrong, there's a trail: what happened, in what order, and when.

Buying a ticket looks like a single click. Behind it, a chain of things happens: the seat is held, payment is confirmed, the ticket is generated, an email goes out, the organiser's report updates, the fraud check runs. If all of that is one long chain of calls, it takes just one part stalling – say the email service – and the buyer sees an error even though the payment went through.

A queue: “it's written down, it will be done”

A message queue (e.g. Amazon SQS) is like a mailbox between two parts of a system. One part drops a message (“order 123 is paid”) and moves on immediately. The other picks it up when it gets to it – and if it's down right now, the message waits.

  • Peaks get absorbed. A thousand orders a second don't have to be processed in that same second. The queue takes them in, and processing runs at a steady pace.
  • Failures stay local. If the email service goes down, checkout keeps working; messages wait and are processed when the service is back.
  • Retries are built in. A message that wasn't processed successfully goes back to the queue. If it still fails after several attempts, it moves to a separate error queue (a dead-letter queue) – nothing is lost silently.

One event, many receivers

Amazon SNS (or any similar publish–subscribe system) answers a different question: what if several parts of the system need to know about the same event? Instead of the payment service calling email, tickets, reporting and fraud checks one by one, it publishes one event – “paid” – and each interested part has its own queue and handles it at its own pace. New parts are added without touching the existing ones.

The ticketing example

  • The buyer pays → a paid event is published.
  • Ticket queue: generates the ticket and sets the seat status to “paid”.
  • Email queue: sends the confirmation; if the service is slow, the buyer has still bought.
  • Reporting queue: the organiser sees sales almost in real time.
  • Fraud queue: checks for suspicious patterns without slowing checkout down.

One thing is mandatory: every consumer must handle the same message twice. Queues guarantee a message arrives at least once, not exactly once. So every message carries a unique key and the consumer checks “have I already done this” – and a buyer never gets two tickets for one payment.

The chat example

In chat, order is everything. “On my way” after “where are you?” makes sense; the other way round doesn't. Standard queues don't guarantee order, so FIFO queues are used (e.g. SQS FIFO), where every conversation is its own message group: order is strict within a conversation, while different conversations are processed in parallel. The same “new message” event then fans out – push notification, search, moderation – each in its own queue.

We have to know what happened – and when

The biggest payoff shows up when something goes wrong. A customer says: “I paid, but there's no ticket.” Without events, the team digs through the logs of five services and guesses. With events, the answer is a list: held at 20:00:03, paid at 20:01:12, ticket generated at 20:01:13, email bounced at 20:01:14 – address doesn't exist.

It's worth knowing that a queue on its own is not an archive – an SQS message disappears once it's processed. So besides being sent to queues, events are also written to a durable log (an append-only table, file storage, or a system like Kafka that keeps history). That way you can:

  • reconstruct the exact flow of any order or conversation,
  • resolve a complaint in minutes, not days,
  • replay events through fixed processing when needed,
  • keep a trail for accounting and for disputes with payment providers.

When you need this

Not every site does. But if one customer action triggers several steps, if you have peaks, or if people ask “what exactly happened to my order” – queues and an event log are one of the most cost-effective changes you can make to your architecture. How it all behaves under pressure is checked with a load test, and we wrote about ticket sales themselves here.

Want to know where your site's limit is?

Audit from €990, fixed price. We start by asking how you run things today.

Request an audit →

Blog

Read more

Basics

QA, environments and Gitflow: getting code to production without surprises

Customers only ever see one environment – production. Three more sit backstage, and that's where all the work and all the mistakes should happen. The basics any team can introduce step by step.

Read →
High traffic

Ticket drops, launches, flash sales: surviving the second everyone clicks at once

A concert ticket drop or a product launch is the hardest test a system can face. It isn't decided by one server but by a set of decisions made in advance – and at the centre there's almost always a distributed Redis.

Read →
Architecture

A fast site starts with understanding the browser

What to load first, what can wait, what's static and what really has to be computed per visitor. The decisions that decide speed – and whether a site survives peak traffic.

Read →
Good practice

A portal that survives peak traffic: 6 good practices for classifieds and news sites

Classifieds and news portals share a similar architecture – and similar weak spots. Here are six things we check first, and how to fix them.

Read →
Databases

Database migrations: why they belong in your CI/CD pipeline

Code ships automatically, but the database is often changed by hand, “quickly, in production”. That's where most nasty surprises come from.

Read →
Basics

What DevOps actually does – one August, as an example

DevOps engineers are the reason a site stays up when everyone arrives at once. Here is what that looks like in practice.

Read →
Audit

Why an audit pays off before the season, not after

You can learn your system's limit in two ways: in advance, calmly – or mid-season, from your customers.

Read →
Security

What a web application firewall is – and who needs one

A web application firewall (WAF) is a guard at the gate: it lets guests in and stops those who come to do damage.

Read →
Reliability

A backup you've never restored isn't a backup

Most companies have backups. Far fewer have ever checked whether they can be restored.

Read →