Java Reference
In-Depth Information
JMS message queues require a Name property, in our example we simply chose to use
the JNDI name of our queue (minus the jms/ prefix) as the value of this property.
The options under the Connector Resource section in the New JMS Re-
source wizard are connection factories that can be used to obtain a JMS
Queue or Session. With Java EE it is simpler to have the JMS Queue or
Session injected directly into the code rather than obtaining it through a
connection factory.
At this point we have created a JMS queue to act as a JMS destination for our
application; we also need to create a JMS connection factory. The JMS queue and
connection factory will not actually be created until we deploy our project.
The first few steps in creating a connection factory are exactly the same as the ones
we used for creating the queue ( File | New File , select GlassFish and JMS Resource ,
then click Next> ).
At this point we simply need to select javax.jms.ConnectionFactory as the resource
type and enter a suitable JNDI name for our connection factory.
Selecting javax.jms.ConnectionFactory as the resource type has the advantage of
allowing us to use this resource to create connections for both queues and topics.
If we only need to create one or the other, we can select to create a resource of type
javax.jms.TopicConnectionFactory or javax.jms.QueueConnectionFactory as
appropriate. However, choosing javax.jms.ConnectionFactory allows more flexibility.
 
Search WWH ::




Custom Search