Rabbit Hunter is a lightweight command-line tool for interacting with RabbitMQ queues. It supports secure and non-secure connections and lets you inspect, consume, requeue, reject, and purge messages.
It does not include any publishing, except for the bulk_upload
method.
This tool is bundled as a single executable: rabbit-hunter.exe
.
To install Rabbit Hunter directly from GitHub:
pip install git+https://github.com/swedwise/RabbitHunter.git
Download or compile the tool using PyInstaller as follows:
pyinstaller --onefile --name rabbit-hunter rabbithunter/cli.py
This will generate rabbit-hunter.exe
in the dist/
folder.
Run the tool by executing:
rabbit-hunter.exe <command> [OPTIONS]
To get help on the main CLI or any subcommand:
rabbit-hunter.exe --help
rabbit-hunter.exe <command> --help
Fetch one message without acknowledging it (non-destructive read).
rabbit-hunter.exe peek --host <host> --port <port> --username <user> --password <pass> --vhost <vhost> --queue <queue>
Fetch one message and acknowledge it (consumes the message).
rabbit-hunter.exe pop --host <host> --port <port> --username <user> --password <pass> --vhost <vhost> --queue <queue>
Fetch one message and reject it with requeue, returning it to the queue.
rabbit-hunter.exe requeue --host <host> --port <port> --username <user> --password <pass> --vhost <vhost> --queue <queue>
Fetch one message and reject it without requeue, discarding it permanently.
rabbit-hunter.exe reject --host <host> --port <port> --username <user> --password <pass> --vhost <vhost> --queue <queue>
Clear all messages from a queue. Prompts for confirmation ([y/N]).
rabbit-hunter.exe purge --host <host> --port <port> --username <user> --password <pass> --vhost <vhost> --queue <queue>
The drain command is used to drain (i.e., read and remove) all messages from a specified queue and save them to a JSON file for later processing or bulk uploads.
rabbit-hunter.exe drain --host <host> --port <port> --username <username> --password <password> --vhost <vhost> --queue <queue> --output <output_file_path>
The bulk_upload command allows you to read messages from a JSON file and upload them to a specified queue or exchange in RabbitMQ. This operation preserves message properties like delivery mode, routing keys, and headers.
rabbit-hunter bulk_upload --host <host> --port <port> --username <username> --password <password> --vhost <vhost> [--queue <queue> | --exchange <exchange>] --input <input_file>
Note:
-
--queue
: (Optional) The target queue where messages will be uploaded. If specified, the queue name is used as the routing key. -
--exchange
: (Optional) The target exchange. If specified, therouting_key
from the message properties will be used to route the message to the correct destination.
- If port is 5671 (default SSL), SSL is enabled automatically.
- If port is 5672 (default non-SSL), no SSL is used.
No manual SSL toggle needed — the port determines the mode.
rabbit-hunter.exe peek \
--host myrabbit.com \
--port 5671 \
--username myuser \
--password mypassword \
--vhost myvhost \
--queue myqueue
MIT License