Using the JMS send command

When debugging or testing code, it is very handy to be able to send messages to a specific queue. This can be done from the command console in Karaf using the JMS subshell.

Getting ready

Make sure that the JMS feature is installed and available. In order to use most of the commands via JMS, we need to have a connection factory created (see the Using the JMS connection factory commands recipe).

How to do it…

First, let's make sure the service is in place using the info command. The connection factory can be referenced either from the specified name cookbook or by the JNDI service name jms/cookbook, as we can see in the following command:

karaf@root()> jms:info jms/cookbook

Property | Value   
-------------------
product | ActiveMQ ...

Get Apache Karaf Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.