The Java EE 7 Tutorial
46 Java Message Service Examples
This chapter provides examples that show how to use the JMS API in various kinds of Java EE applications. It covers the following topics:
-
Sending and Receiving Messages Using a Simple Web Application
-
Receiving Messages Asynchronously Using a Message-Driven Bean
A final section covers Using NetBeans IDE to Create JMS Resources.
The examples are in the tut-install/examples/jms/
directory.
The steps to build and run each example are as follows.
-
Use NetBeans IDE or Maven to compile, package, and in some cases deploy the example.
-
Use NetBeans IDE, Maven, or the
appclient
command to run the application client, or use the browser to run the web application examples.
Before you deploy or run the examples, you need to create resources for them. Some examples have a glassfish-resources.xml
file that is used to create resources for that example and others. You can use the asadmin
command to create the resources.
To use the asadmin
and appclient
commands, you need to put the GlassFish Server bin
directories in your command path, as described in SDK Installation Tips.