Creating JMS resources from NetBeans
Before we can send and receive JMS messages, we need to add a JMS destination
(queue or topic) in our application server. When using GlassFish as our application
server, we can create JMS destinations directly from any Java EE project in NetBeans.
Older versions of Java EE required the creation of a JMS connection
factory in addition to JMS destinations. The Java EE 7 specification
requires all compliant application servers to supply a default JMS
connection factory; therefore, this step is no longer necessary.
JMS destinations are an intermediate location where JMS producers place messages
and JMS consumers retrieve them. When using the PTP messaging domain, JMS
destinations are message queues, whereas with the pub/sub messaging domain,
the destination is a message topic.
In our example, we will use the PTP messaging domain. Therefore, we need to create
a message queue; the procedure to create a message topic is almost identical.
First, we need to create a new Java EE project; for our example, we will create a
Web Application project: