Schedule icon
Fail icon
Request icon
If icon
Log icon
SlackIncomingWebhook icon
Pause icon
DeclareExchange icon
CreateQueue icon
QueueBind icon

RabbitMQ Missing Queue Binding Restore Guard

Detect a missing RabbitMQ queue binding from exact management API topology and restore one direct binding after approval.

Categories
DataInfrastructure

This blueprint was created by zkasuran.

A RabbitMQ exchange and durable queue can remain present while their binding is absent. The management API can show that topology state without asserting publisher or consumer behavior. This guard reads the binding list itself, so a report-only or dry-run execution never publishes or consumes an application message.

How it works

  1. list_initial_bindings uses io.kestra.plugin.core.http.Request for the one capability the AMQP plugin does not expose: RabbitMQ's management API binding inventory. The JSON is decoded and compared field by field for the exact exchange, queue, direct type, routing key and empty arguments.
  2. A missing exact object sends one native Slack notification. The disabled schedule pins auto_remediate=false and dry_run=true.
  3. A live repair requires auto_remediate=true, dry_run=false and an explicit approval. The flow re-reads the binding after the pause, then reads the exchange, queue and binding immediately before each native DeclareExchange, CreateQueue and QueueBind task.
  4. Only a durable direct exchange, a durable non-exclusive queue and an empty-arguments binding are eligible. Incompatible declarations or a conflicting binding fail closed.
  5. A final management API read must find the exact binding or the execution fails. No canary is published or consumed, because consuming a live queue can acknowledge an unrelated application message.

What you get

  • An exact management API detector for one exchange, queue and routing key.
  • A dry-run path that performs GET requests and Slack reporting without touching queue data.
  • Approval-gated native exchange declaration, queue declaration and binding restoration.
  • Fresh eligibility reads before each topology write and a final exact binding read.

Who it's for

  • Platform teams operating RabbitMQ routes after deploys or broker recovery.
  • SRE teams that need a safe report-only check for silent message loss.
  • Application owners who need one reviewed direct binding repaired without draining a live queue.

Why orchestrate this with Kestra

A shell command can query RabbitMQ, but it does not provide a durable approval pause, an auditable branch or a native AMQP write task. Kestra records the exact management reads, approval value, topology writes and final verification in one execution.

Tested end to end

Validate against RabbitMQ 3.13-management and Kestra 2.0.6. Use an account with management read access for the exchange, queue and binding endpoints, AMQP configure/write/read permissions for the named resources and bind permission for the repair path. The flow does not delete resources or consume queue data.

Case Execution Result
Healthy 1mrChznCXVkXRW2WnbjhWY SUCCESS. One exact binding found, no write
Missing binding, dry run 7MLYENy13H5TorChrm4wHg SUCCESS. 0 exact bindings, report only, no write
Declined approval QSb3QlCFbk0UQgVtc3186 SUCCESS. Binding still missing, no write
Approved repair 3TGrvwpuE4h7G0JWAcQ4NO SUCCESS. Exact bindings 0 to 1, the protected queue binding unchanged
Repeat 65HbhQ9HChfnwLwypRf5cd SUCCESS. Healthy branch, no write
Binding restored during the Pause 41cwK4VbzgLGcb9jdOmeoE SUCCESS. Recovered branch, no write
Fanout exchange 4yRQ1RdF5xKOzhLSblM8Nm FAILED as intended. Refused before any write
Same route through an argument binding 4R22MuWsCtJrdnjuQofG4R FAILED as intended. Existing route found, bindings unchanged
Queue already bound with another key 79CFpVt9dBMI9Pw7MxqqYn FAILED as intended. Bindings unchanged
Queue already reached by a wildcard binding 2jLMEpaur0PgFp3tB9BIFw FAILED as intended. Bindings unchanged
Exchange-to-exchange destination 4679W7ag6wo5sJ1CK3utoG FAILED as intended. Bindings unchanged
Route through an intermediate exchange 1EtUD2dk02TrAzbGTcxIoR FAILED as intended. Bindings unchanged
Killed after the exchange was declared 23kWlelzX4TgwE23yuUBnA KILLED. Exchange kept, queue not created
Next run after the interruption FCxqBRFsacigK8RElIE6q SUCCESS. Reconciled and completed the repair
Quoted, Unicode and spaced names 6O5zYmGy6jN45qMrTsF2hn SUCCESS. One exact binding restored
Newline in a name 3Xat7f8FgLB9xz2PZ8TayB FAILED as intended. Rejected before any broker read
Queue holding an application message 68rSKo2rzJJKsQzHQsbkts SUCCESS. Message count 1 before and after
Queue deleted during the Pause 5tNuLF6YgCpAWPUQMf7qMw SUCCESS. Queue recreated and bound
Management API unreachable 5C18YSo19Kpf3XoUc7Oqgf FAILED as intended. Failure alert sent, no write
No bindings in the vhost 5QpCez2w0t6yM2BpZFeO1L SUCCESS. Report only
More than 1000 unrelated bindings 6xHNiOCn1fLmoiW3WLbZhk SUCCESS. Healthy branch
Two runs, first holds the approval 7KUXgqDOhX8wSdauEGG8t0 SUCCESS. Repair applied
Two runs, second queued 21K9C0U1sC50N8xOP7RCie SUCCESS. Queued then healthy
Fresh RabbitMQ: healthy 12NJhJ6Pywok1VVI37ox3f SUCCESS
Fresh RabbitMQ: approved repair 5ZowygAKmJwv8uBINVWOI SUCCESS. Exact bindings 0 to 1
Fresh RabbitMQ: restored during the Pause 1Ul7rNwIzXgyImE8XVzWmN SUCCESS. No write

Prerequisites

  • Kestra 2.0.6 or later with the AMQP, HTTP and Slack plugins.
  • RabbitMQ 3.13-management (the tested service) with the management API enabled.
  • A durable direct exchange and durable non-exclusive queue or permission to declare them during approved remediation.

Secrets

  • RABBITMQ_HOST, RABBITMQ_PORT, RABBITMQ_MANAGEMENT_PORT, RABBITMQ_USERNAME, RABBITMQ_PASSWORD and RABBITMQ_VHOST for the AMQP and management API connections.
  • SLACK_WEBHOOK_URL for the native Slack notification and failure alert.

Inputs

  • exchange, queue and routing_key identify one direct route.
  • auto_remediate must be true and dry_run must be false before the approval path can write.

Quick start

  1. Add the RabbitMQ and Slack secrets to Kestra.
  2. Import the flow and run it with auto_remediate=false and dry_run=true.
  3. Review the management API finding and the exact exchange, queue, routing key, declaration shape and empty binding arguments shown in the approval pause.
  4. Resume with approved=true only when the direct exchange and queue are owned by this runbook.

How to extend

  • Run the flow once for each routing key.
  • Add a reviewed TOPIC variant with its own binding arguments and cases instead of widening this direct-only guard.
  • Add a change-management link to the approval description and Slack payload.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.