Menu

Migrating a Task Queue's Broker Without Losing a Single Job in Flight
πŸ“°

Migrating a Task Queue's Broker Without Losing a Single Job in Flight

DEV Community: terraformΒ·Athila FigueiredoΒ·2 days ago
#rnmRbTEa
#devtoterraform#devto#dev#group#broker
Long article (297 words) β€” no AI summary yet.
Reading 0:00
15s threshold

The problem

Swapping the broker behind a task queue sounds like a connection-string change until you ask the real question: what happens to the job that's mid-flight at the exact moment you cut over? Lose it, and work silently disappears β€” no error, no log, just a task that never runs. Duplicate it, and you've charged a card twice or sent a notification twice.

The pattern

A four-phase state machine for the cutover: parallel β†’ cutover β†’ draining β†’ decommissioned .

Explicit rules for which transitions are allowed, including rollback, at every phase.

The old broker only gets decommissioned once two independent signals agree it's actually empty β€” not one check that could be wrong, not a timer, not an assumption.

Terraform provisions the replacement broker (ElastiCache/Valkey): replication group, subnet group, security group, parameter group.

Security findings that came from a real tool, not a self-assessment

This is the project where Checkov stopped being theoretical.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.