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.
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).
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 version | 5.9.0
Now that we have verified the JMS connection factory, we can use it to send messages to the broker. This can be done using the following command:
karaf@root()> jms:send jms/cookbook cookbookQueue "the recipes are sweet...