Java Reference
In-Depth Information
Figure 10-2. Glassfish Administration Console New JMS Destination Resource
3. Click “OK” to create the destination.
Application server resources can also be generated via a command-line or terminal using the asadmin
create-jms-resource command. The following demonstrates usage of the create-jms-resource command,
although you can see the complete help by typing asadmin create-jms-resource -help .
create-jms-resource [--help]
--restype type
[--target target]
[--description text]
[--property (name=value)[:name=value]*]
ConnectionFactory objects are registered automatically with JNDI once created, and they can then be injected
into Java classes and used. The following lines of code demonstrate how to inject a ConnectionFactory resource into
a class:
@Resource(name = "jms/MyConnectionFactory")
private static ConnectionFactory connectionFactory;
Destination resources can be injected into Java classes in the same manner as ConnectionFactory resources.
The following lines of code demonstrate the injection of a Topic resource.
private Topic myTopic;
Search WWH ::

Custom Search