buneary

buneary, pronounced bun-ear-y, is an easy-to-use RabbitMQ command line client for managing exchanges, managing queues and publishing messages to exchanges.

buneary


Example

In the following example, a message Hello! is published and sent to an exchange called my-exchange. The RabbitMQ server is running on the local machine, and we’ll use a routing key called my-routing-key for the message.

$ buneary publish localhost my-exchange my-routing-key "Hello!"

Since the RabbitMQ server listens to the default port, the port can be omitted here. The above command will prompt you to type in the username and password, but you could do this using command options as well.

Installation

macOS/Linux

Download the latest release for your platform. Extract the downloaded binary into a directory like /usr/local/bin. Make sure the directory is in PATH.

Windows

Download the latest release, create a directory like C:\Program Files\buneary and extract the executable into that directory. Add the directory to Path.

Docker

Just append the actual buneary command you want to run after the image name.

Because buneary needs to dial the RabbitMQ server, the Docker container needs to be in the same network as the RabbitMQ server. For example, if the server is running on your local machine, you could run a command as follows:

$ docker container run --network=host dominikbraun/buneary version

Usage

Create an exchange

Syntax:

$ buneary create exchange 
[flags]

Arguments:

Argument Description
ADDRESS The RabbitMQ server address. If no port is specified, 5672 is used.
NAME The desired name of the new exchange.
TYPE The exchange type. Has to be one of direct, headers, fanout and topic.

Flags:

Flag Short Description
--user -u The username to connect with. If not specified, you will be asked for it.
--password -p The password to authenticate with. If not specified, you will be asked for it.
--auto-delete Automatically delete the exchange once there are no bindings left.
--durable Make the exchange persistent, surviving server restarts.
--internal Make the exchange internal.

Example:

Create a direct exchange called my-exchange on a RabbitMQ server running on the local machine.

$ buneary create exchange localhost my-exchange direct

Create a queue

Syntax:

$ buneary create queue 
[flags]

Arguments:

Argument Description
ADDRESS The RabbitMQ server address. If no port is specified, 5672 is used.
NAME The desired name of the new queue.
TYPE The queue type. Has to be one of classic and quorum.

Flags:

Flag Short Description
--user -u The username to connect with. If not specified, you will be asked for it.
--password -p The password to authenticate with. If not specified, you will be asked for it.
--auto-delete Automatically delete the queue once there are no consumers left.
--durable Make the queue persistent, surviving server restarts.

Example:

Create a classic queue called my-queue on a RabbitMQ server running on the local machine.

$ buneary create queue localhost my-queue classic

Create a binding

Syntax:

$ buneary create binding 
[flags]

Arguments:

Argument Description
ADDRESS The RabbitMQ server address. If no port is specified, 5672 is used.
NAME The desired name of the new binding.
TARGET The name of the target queue or exchange. If it is an exchange, use --to-exchange.
BINDING KEY The binding key.

Flags:

Flag Short Description
--user -u The username to connect with. If not specified, you will be asked for it.
--password -p The password to authenticate with. If not specified, you will be asked for it.
--to-exchange Denote that the binding target is another exchange.

Example:

Create a binding from my-exchange to my-queue on a RabbitMQ server running on the local machine.

$ buneary create binding localhost my-exchange my-queue my-binding-key

Publish a message

Syntax:

$ buneary publish 
[flags]

Arguments:

Argument Description
ADDRESS The RabbitMQ server address. If no port is specified, 5672 is used.
EXCHANGE The name of the target exchange.
ROUTING KEY The routing key of the message.
BODY The actual message body.

Flags:

Flag Short Description
--user -u The username to connect with. If not specified, you will be asked for it.
--password -p The password to authenticate with. If not specified, you will be asked for it.

Example:

Publish a message Hello! to my-exchange on a RabbitMQ server running on the local machine. Note that message headers have not been implemented yet.

$ buneary publish localhost my-exchange my-routing-key "Hello!"

Delete an exchange

Syntax:

$ buneary delete exchange 
[flags]

Arguments:

Argument Description
ADDRESS The RabbitMQ server address. If no port is specified, 5672 is used.
NAME The name of the exchange to be deleted.

Flags:

Flag Short Description
--user -u The username to connect with. If not specified, you will be asked for it.
--password -p The password to authenticate with. If not specified, you will be asked for it.

Example:

Delete an exchange called my-exchange on a RabbitMQ server running on the local machine.

$ buneary delete exchange localhost my-exchange

Delete a queue

Syntax:

$ buneary delete queue 
[flags]

Arguments:

Argument Description
ADDRESS The RabbitMQ server address. If no port is specified, 5672 is used.
NAME The name of the queue to be deleted.

Flags:

Flag Short Description
--user -u The username to connect with. If not specified, you will be asked for it.
--password -p The password to authenticate with. If not specified, you will be asked for it.

Example:

Delete a queue called my-queue on a RabbitMQ server running on the local machine.

$ buneary delete queue localhost my-queue

Credits

GitHub

https://github.com/dominikbraun/buneary