Book Image

Apache Karaf Cookbook

By : Jamie Goodyear, Johan Edstorm, Achim Nierbeck, Heath J Kesler
Book Image

Apache Karaf Cookbook

By: Jamie Goodyear, Johan Edstorm, Achim Nierbeck, Heath J Kesler

Overview of this book

Table of Contents (17 chapters)
Apache Karaf Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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
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...