Abstract, extensible RabbitMQ error-queue remediation tool
Project description
Abstract, extensible RabbitMQ error-queue remediation.
Classify → remediate → audit — fully configurable, no code required for common cases.
What Is It?
RMQ Healer watches RabbitMQ error queues and automatically remediates known failure patterns — classify, remediate, audit — fully configurable, no code required for common cases.
When you probably don't need this tool
In a well-designed RabbitMQ system, error queues don't accumulate indefinitely. A properly configured setup handles failure natively:
- Dead-letter exchanges (DLX) — messages that are rejected, expired, or exceed queue length limits are automatically routed to a designated dead-letter queue
- Message TTL — messages that sit too long are expired and dead-lettered rather than silently dropped
- Consumer retry logic — consumers catch transient errors, requeue with backoff, and reject permanently after N attempts
- Dedicated error consumers — purpose-built services subscribe to error queues and handle known failure modes inline
If you control the system and have the bandwidth to implement these properly, you should — they are the right long-term answer.
When RMQ Healer is the right tool
RMQ Healer is built for situations where reconfiguring the messaging system is not an option:
- Legacy processors you can't modify — the consumer is a vendor library, a third-party service, or a system outside your control
- No technical bandwidth for a proper fix — reconfiguring RabbitMQ topology, updating consumers, and testing safely takes time you don't have right now
- Temporary remediation during migration — you're moving toward a better architecture but need something working in the meantime
- Operational recovery — a bad deployment filled an error queue and you need to safely triage, replay, and audit the affected messages
In all of these cases, RMQ Healer gives you a safe, auditable, externally-configurable remediation layer — without modifying the application that produced the messages.
Features
Zero-loss processing, declarative YAML rules, a rich built-in action library (log, mutate_json, set_headers, python_script, republish, quarantine, route_unknown, drop), Python script hooks for arbitrary logic, Prometheus metrics, dry-run with diffs, and an interactive terminal TUI for config editing, rule management, live runs, and queue inspection.
Architecture
Classify → remediate → audit. Messages are acked only after a terminal action succeeds — if anything fails, the message stays in the queue untouched.
flowchart TD
EQ[("Error Queue")]
CL["Classifier\n(first match wins)"]
WF["WorkflowRunner"]
AU["AuditLogger\n(JSON-lines)"]
EQ -->|basic_get| CL
CL -->|matched rule| WF
CL -->|no match| UQ[("Unknown Queue")]
WF --> A1["log / set_headers\nmutate_json / python_script"]
A1 --> T{"Terminal\naction"}
T -->|republish| RQ[("Repaired Queue")]
T -->|quarantine| Q[("Quarantine Queue")]
T -->|route_unknown| UQ
T -->|drop| DONE["Ack + discard"]
WF --> AU
CL --> AU
→ Architecture overview and design decisions
Installation
Recommended: isolated CLI install
Use pipx when you want the rmq-healer command to be available on your shell PATH without manually managing a virtual environment.
python -m pip install --user pipx
python -m pipx ensurepath
pipx install rmq-healer
Restart your shell after pipx ensurepath, then verify:
rmq-healer --version
Alternative: install with pip
python -m pip install rmq-healer
If the install succeeds but rmq-healer is not found, your Python scripts directory is probably not on PATH. Inspect where the command was installed:
python -m pip show -f rmq-healer
python - <<'PY'
import sysconfig
print(sysconfig.get_path("scripts"))
PY
If you use pyenv, refresh shims after installation:
pyenv rehash
Development install
git clone https://github.com/grimnexo/RMQ-Healer.git
cd RMQ-Healer
python -m pip install -e ".[dev]"
Quick Start
# 1. Set broker URL
export RMQ_URL="amqp://guest:guest@localhost/"
# 2. Generate config interactively
rmq-healer configure --output config/queues.yml
# 3. Validate
rmq-healer validate --config config/queues.yml
# 4. Test a rule against a sample message
rmq-healer test-rule --config config/queues.yml \
--queue order-service.error --message examples/retry-timeout/sample.json
# 5. Dry-run with mutation diffs — nothing acked or published
rmq-healer dry-run --config config/queues.yml --all --pretty
# 6. Live run
rmq-healer run --config config/queues.yml --all --pretty
# 7. Peek without consuming
rmq-healer peek --config config/queues.yml --queue order-service.error --count 10
# 8. Visualise a workflow as a Mermaid diagram
rmq-healer workflow render --config config/queues.yml --queue order-service.error
# 9. Search audit logs
rmq-healer audit-search --log audit.jsonl --outcome quarantine
Example Configuration
rabbitmq:
url: "${RMQ_URL}"
prefetch: 10
idempotency:
enabled: true
max_handler_attempts: 3
queues:
- name: order-service.error
enabled: true
rules_file: rules/order-errors.yml
repaired_exchange: order.events
repaired_routing_key: order.retry
quarantine_exchange: ops.errors
quarantine_routing_key: order.quarantine
# rules/order-errors.yml
rules:
- id: transient_timeout
match:
any:
- body_contains: "ETIMEDOUT"
- json_path: $.error.code
equals: "TIMEOUT"
workflow:
- action: set_headers
params:
headers:
x-rmq-healer-rule: transient_timeout
- action: republish
params:
exchange: "{{ queue.repaired_exchange }}"
routing_key: "{{ queue.repaired_routing_key }}"
- id: missing_customer_id
match:
all:
- json_path: $.customer_id
equals: null
workflow:
- action: python_script
params:
script: scripts/lookup_customer.py
timeout: 30
output:
save_as: customer
- action: mutate_json
params:
set:
"$.customer_id": "{{ customer.id }}"
- action: republish
params:
exchange: "{{ queue.repaired_exchange }}"
routing_key: "{{ queue.repaired_routing_key }}"
See the examples/ directory for complete, runnable scenarios.
Documentation
| Topic | Guide |
|---|---|
| Installation & setup | docs/installation.md |
| Configuration reference | docs/configuration.md |
| Writing rules | docs/rules.md |
| Python script actions | docs/python-scripts.md |
| CLI reference (all commands) | docs/cli-reference.md |
| Operations guide | docs/operations.md |
| Docker deployment | docs/docker.md |
| Interactive TUI | docs/developer-gui.md |
| Plugin architecture | docs/plugins.md |
| Metrics & observability | docs/metrics.md |
| Contributing & tooling | docs/contributing.md |
| GitHub workflow | docs/github-workflow.md |
| Troubleshooting | docs/troubleshooting.md |
Developers
Quick start for contributors.
# Windows
.\developer\scripts\setup.ps1 # start RabbitMQ + seed fixtures
.\developer\scripts\run-test.ps1 # dry-run against local broker
.\developer\scripts\teardown.ps1 # stop
# Linux / macOS
bash developer/scripts/setup.sh
bash developer/scripts/run-test.sh
bash developer/scripts/teardown.sh
# Python (cross-platform)
python developer/scripts/dev_setup.py
python developer/scripts/run_test.py
python developer/scripts/dev_teardown.py
→ Full contributor guide · GitHub workflow
License
MIT — see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rmq_healer-0.4.3.tar.gz.
File metadata
- Download URL: rmq_healer-0.4.3.tar.gz
- Upload date:
- Size: 67.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b454731a5892e4350e1bb1fd77aaaf12a9f0b8526578f9d10de0964111d438a2
|
|
| MD5 |
8ff1795961f658cd7e59ffcec8acefaa
|
|
| BLAKE2b-256 |
4a76c6d9a05174960ef9bbc70a575f6296db57b75a04455b16f9f1ae83f29c3f
|
Provenance
The following attestation bundles were made for rmq_healer-0.4.3.tar.gz:
Publisher:
release.yml on grimnexo/RMQ-Healer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rmq_healer-0.4.3.tar.gz -
Subject digest:
b454731a5892e4350e1bb1fd77aaaf12a9f0b8526578f9d10de0964111d438a2 - Sigstore transparency entry: 2164309429
- Sigstore integration time:
-
Permalink:
grimnexo/RMQ-Healer@9c0a4591820c6ca09529db40406ad9b85597ffd3 -
Branch / Tag:
refs/tags/v0.4.3 - Owner: https://github.com/grimnexo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9c0a4591820c6ca09529db40406ad9b85597ffd3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rmq_healer-0.4.3-py3-none-any.whl.
File metadata
- Download URL: rmq_healer-0.4.3-py3-none-any.whl
- Upload date:
- Size: 82.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e439101f3a11577dcc24a4d711fb9fe45951d96d5e5689d1f8160bec19bf24c4
|
|
| MD5 |
399e673d164e627e6c2f4574d3da071d
|
|
| BLAKE2b-256 |
4054a6a15aa018186a11b7a364d3af3c9d83eff8a36a92f46d0d9a8406d32535
|
Provenance
The following attestation bundles were made for rmq_healer-0.4.3-py3-none-any.whl:
Publisher:
release.yml on grimnexo/RMQ-Healer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rmq_healer-0.4.3-py3-none-any.whl -
Subject digest:
e439101f3a11577dcc24a4d711fb9fe45951d96d5e5689d1f8160bec19bf24c4 - Sigstore transparency entry: 2164309447
- Sigstore integration time:
-
Permalink:
grimnexo/RMQ-Healer@9c0a4591820c6ca09529db40406ad9b85597ffd3 -
Branch / Tag:
refs/tags/v0.4.3 - Owner: https://github.com/grimnexo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9c0a4591820c6ca09529db40406ad9b85597ffd3 -
Trigger Event:
push
-
Statement type: