How to send JSON payload to RabbitMQ using the web plugin?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
RabbitMQ is a powerful open-source message broker that can handle complex messaging scenarios. While it primarily interacts with systems through client libraries in various programming languages, the web plugin—particularly the RabbitMQ Management Plugin—provides a convenient interface for managing the server and sending messages directly from a web UI. Here's how to send JSON payloads to RabbitMQ using its web plugin.
Step 1: Install RabbitMQ and Enable the Management Plugin
To use the RabbitMQ web interface, you need to have RabbitMQ installed and running. You can download it from the official RabbitMQ website.
Once installed, enable the management plugin using the following command:
This command will activate the management UI, which can be accessed via http://localhost:15672/, assuming default settings.
Step 2: Accessing the Web Interface
Navigate to http://localhost:15672/ in your web browser. You'll be prompted to log in; by default, the username is guest and the password is guest. After logging in, you're presented with the RabbitMQ management dashboard.
Step 3: Setting Up Exchanges and Queues
Before you can send a message, ensure that you have the necessary exchanges and queues set up. From the management dashboard:
- Go to the "Exchanges" tab, and create a new exchange if needed. Choose an appropriate exchange type (
direct,topic,fanout,headers). - Go to the "Queues" tab, and create a new queue.
- Bind the queue to the exchange with the appropriate routing key, via the queue's "Bindings" tab in the queue details.
Step 4: Sending a JSON Payload
To send a JSON message:
- Go back to the "Exchanges" tab in the RabbitMQ management dashboard.
- Choose the exchange you want to publish your message to.
- Scroll down to "Publish message".
- Insert your routing key.
- Type your JSON payload into the "Payload" field.
Here's an example JSON payload:
- Set the "Properties.ContentType" to
application/json. This step isn't mandatory but is good practice as it tells consumers of the message that it is a JSON object. - Finally, click "Publish message".
Technical Considerations
Understanding how messages are handled in RabbitMQ is crucial for effective use of the system:
- Exchanges distribute the incoming messages to one or more queues based on the routing rules defined (bindings).
- Queues store the messages until they are consumed.
- Bindings determine which messages go into which queues based on routing keys or patterns.
An incorrect setup in any of the above can result in messages not reaching their intended destination.
Security and Access Control
Since the management UI can be accessed via a network, it's crucial to:
- Change the default username and password.
- Restrict access to trusted IP addresses.
- Regularly update RabbitMQ and its plugins to mitigate vulnerabilities.
Summary Table
Here's a quick reference for the steps outlined:
| Step | Action | Notes |
| 1. Install and Enable Plugin | rabbitmq-plugins enable rabbitmq_management | Access via default http://localhost:15672/ |
| 2. Log in | Default: guest / guest | Change default credentials for security. |
| 3. Setup Exchange and Queue | Create and bind via web interface | Required before sending messages. |
| 4. Publish JSON Payload | Use Exchange tab's "Publish message" feature | Set ContentType to application/json. |
Conclusion
Sending JSON payloads through the RabbitMQ web plugin is straightforward once the necessary setup is done. This method is particularly useful for testing purposes, manual interventions, or infrequent administrative postings. For regular application interactions, using a RabbitMQ client library in a programming language of your choice is recommended, as it allows for more robust and complex handling of messages.
Related reading
- How to send message in rabbitmq on docker?
- How to send message to a particular partition in Kafka?
- How to send messages synchronously in kafka?
- How to send output of two different Spout to the same Bolt?
- How to set cleanup.policy 'delete' AND 'compact' for a Kafka topic?
- How to set consumer.id for new Kafka consumer
- How to set group name when consuming messages in kafka using command line?
- How to set group.id for consumer group in kafka data source in Structured Streaming?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.