Fikkie.
← All posts

FIFO queues for order-sensitive workflows

Why generic queues can reorder work, and how strict FIFO logic keeps order-sensitive data reliable.

Article

Most queue documentation shows a simple picture: push a job, a worker picks it up. In practice, when you scale workers up, ordering silently breaks. For most workloads that’s fine. For order-sensitive workflows — where record B must never be processed before record A — it’s a bug that corrupts data.

Where ordering goes wrong

Concurrency is the enemy of order. Run two workers on the same queue and either one can grab the next job, regardless of sequence. Add retries and dead-letter handling and the problem gets worse: a failed job may be re-queued behind jobs that were supposed to wait for it.

FIFO as a guarantee

Strict FIFO means items are consumed in the exact order they were enqueued — first in, first out. Implementing it properly requires more than a single queue with a misleading name:

  • A single consumer for the ordered stream, or a per-key partitioning scheme when parallelism is unavoidable.
  • Retry semantics that preserve position, so a failure doesn’t push a job out of sequence.
  • Idempotent processing, so replaying a job after a crash produces the same result.

What I actually shipped

At JMC Indonesia I implemented FIFO queue logic for order-sensitive data workflows and used RabbitMQ to bridge real-time messaging between an Electron client and backend services. The pattern that worked was: one consumer per ordered stream, careful retry handling, and idempotent jobs.

Ordering guarantees are a design decision, not a default. If you need them, make them explicit — otherwise your data will eventually surprise you.