May 28, 2025•3 min read

Good question. Sometimes you just need to test something quickly, you want to trigger a specific job, or you want to retry a task that failed. All of those are valid reasons to manually publish a message to RabbitMQ. What sounds like a dead simple task is actually more painful than you might think. In this article we will go over some ways to publish messages directly to RabbitMQ, from painful to effortless using RabbitGUI.
While this is not the most practical solution, it is still a solution in case you have nothing else. To publish a message in RabbitMQ using JavaScript, you’ll typically use the amqplib library. First, install the library:
npm install amqplibThen, run a script like this:
import amqplib from 'amqplib';
const conn = await amqplib.connect('amqp://localhost');
const ch = await conn.createChannel();
ch.publish(
'my-exchange',
'my.routing.key',
Buffer.from(JSON.stringify({ foo: 'bar' }))
);This example connects to RabbitMQ, creates a channel, and sends a JSON-encoded message to it. Pretty straight forward and might do the trick if you need to connect to an external API or do some computation before sending the messages.
The simplest approach is to use RabbitGUI, which lets you publish messages to a specific queue or exchange with just a few clicks and a full-fledged JSON editor. Go to any queue and go to the "Publish" tab:

Compared to the built-in RabbitMQ management plugin, RabbitGUI provides quite a few quality-of-life improvements, such as :
⇧⌥FAlternatively, you can go to the "Publish" tab of an exchange and publish a message from there. The UI is similar, and you have autocompletion on the routing key based on the bindings of the exchange.

Note that the history of messages you publish is stored in RabbitGUI and shared across queues and exchanges, so you can easily find the messages you published in the past no matter where you sent it from.
You can learn more about RabbitGUI here.
You can use the management plugin to publish messages to RabbitMQ. There are two ways to do so: either to a specific queue or to an exchange. To send a message to a specific queue, go to the "Queues" tab in the management plugin, select the queue you want to send a message to, and unfold the "Publish message" section. You can then enter the message body and properties:

Note that the message will be sent to the default exchange with the name of the queue as the routing key, which means that it will be routed to the queue you selected. If you want to send a message to an exchange, go to the "Exchanges" tab, select the exchange you want to send a message to, and unfold the "Publish message" section. You can then enter the message body and properties:

Unlike RabbitGUI, the management plugin does not provide a JSON editor, and it will not highlight syntax errors for you. It also does not provide autocompletion for the routing key, so you will have to know the routing key you want to use.
RabbitMQ: maximum size of a messageThe maximum size of a message in RabbitMQ is not defined by the protocol, but by the implementation. Unfortunately, this value is not well documented and has changed a lot over time
How to visually explore RabbitMQ queue bindingsThere are many ways messages can be routed to queues in RabbitMQ, and it can be hard to understand how they are connected in a single place
Debugging policies in RabbitMQWhile rules regarding which policies are applied to which queues are simple, visually understanding what is going on when something does not behave as expected might be trickyDebug, monitor, and manage RabbitMQ with a modern developer interface.
Try now