1. Introduction
ActiveMQ is a popular messaging broker from Apache written in Java. Sometimes you'll need to send a message directly to the topic or queue on ActiveMQ. You might need this, for example, to test your message consumer. In this tutorial, we'll show how to send messages to the ActiveMQ queue or topic through its web console.
2. Steps
The admin console of ActiveMQ is available on http://yourHost:8161/admin, and you'll be prompted for the admin console username and password. Default parameters are "admin" for username and "admin" for password. After you log in, you'll see a page like this:
In the header menu, you'll see links to pages that can show you a list of your queues, topics, subscribers. etc. If you want to send a message to your queue, click Queues, and in case you want to send it to the topic, click Topics. You'll end up on the following page:
Next to the name of your queue, you'll see Send To link that will take you to Send a JMS Message page.
If you get to this page from the queue/topic list, your Destination field (name of the queue/topic) will be filled for you. If you click on the Send URL on the header menu, you'll need to manually enter the name of your queue or topic. The header to store the counter is automatically set to JMSXMessageCounter. Your message will go into Message body text area, after that you can just click Send. Message could even be a JSON, you can just paste it in there.
To check status of your queue, you can jump to Queues in the main menu, and check the following fields in table:
- Number Of Pending Messages
- Number Of Consumers
- Messages Enqueued
- Messages Dequeued
3. Conclusion
In this tutorial, we showed how to send JMS messages to the Apache ActiveMQ queue or topic. Check out our other tutorials about JMS here.