Oracle GlassFish Server 3.0.1 Administration Guide

Administering JMS Connection Factories and Destinations

The JMS API uses two kinds of administered objects. Connection factory objects allow an application to create other JMS objects programmatically. Destination objects serve as repositories for messages. How these objects are created is specific to each implementation of JMS. In GlassFish Server, JMS is implemented by performing the following tasks:

JMS applications use the Java Naming and Directory Interface (JNDI) API to access the connection factory and destination resources. A JMS application normally uses at least one connection factory and at least one destination. By studying the application or consulting with the application developer, you can determine what resources must be created. The order in which the resources are created does not matter.

GlassFish Server provides the following types of connection factory objects:

GlassFish Server provides the following types of destination objects:

The following topics are addressed here:

The subcommands in this section can be used to administer both the connection factory resources and the destination resources. For instructions on administering physical destinations, see Administering JMS Physical Destinations.

ProcedureTo Create a Connection Factory or Destination Resource

For each JMS connection factory that you create, GlassFish Server creates a connector connection pool and connector resource. For each JMS destination that you create, GlassFish Server creates a connector admin object resource. If you delete a JMS resource, GlassFish Server automatically deletes the connector resources.

Use the create-jms-resource command in remote mode to create a JMS connection factory resource or a destination resource.


Tip –

To specify the addresslist property (in the format host:mqport,host2:mqport,host3:mqport) for the asadmin create-jms-resource command, escape the : by using \\. For example, host1\\:mqport,host2\\:mqport,host3\\:mpqport. For more information about using escape characters, see the asadmin(1M) concepts page.


To update a JMS connection factory, use the set subcommand for the underlying connector connection pool, See To Update a Connector Connection Pool.

To update a destination, use the set subcommand for the admin object resource. See To Update an Administered Object.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. Create a JMS resource by using the create-jms-resource(1) command.

    Information about the properties for the subcommand is included in this help page.

  3. (Optional) If needed, restart the server.

    Some properties require server restart. See Configuration Changes That Require Server Restart. If your server needs to be restarted, see To Restart a Domain.


Example 19–5 Creating a JMS Connection Factory

This example creates a connection factory resource of type javax.jms.ConnectionFactory whose JNDI name is jms/DurableConnectionFactory. The ClientId property sets a client ID on the connection factory so that it can be used for durable subscriptions. The JNDI name for a JMS resource customarily includes the jms/ naming subcontext.


asadmin> create-jms-resource --restype javax.jms.ConnectionFactory
--description "connection factory for durable subscriptions"
--property ClientId=MyID jms/DurableConnectionFactory
Command create-jms-resource executed successfully.


Example 19–6 Creating a JMS Destination

This example creates a destination resource whose JNDI name is jms/MyQueue.


asadmin> create-jms-resource --restype javax.jms.Queue 
--property Name=PhysicalQueue jms/MyQueue
Command create-jms-resource executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help create-jms-resource at the command line.

ProcedureTo List JMS Resources

Use the list-jms-resources subcommand in remote mode to list the existing connection factory and destination resources.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. List the existing JMS resources by using the list-jms-resources(1) subcommand.


Example 19–7 Listing All JMS Resources

This example lists all the existing JMS connection factory and destination resources.


asadmin> list-jms-resources
jms/Queue
jms/ConnectionFactory
jms/DurableConnectionFactory
jms/Topic
Command list-jms-resources executed successfully


Example 19–8 Listing a JMS Resources of a Specific Type

This example lists the resources for the resource type javax.


asadmin> list-jms-resources --restype javax.jms.TopicConnectionFactory 
jms/DurableTopicConnectionFactory 
jms/TopicConnectionFactory 
Command list-jms-resources executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help list-jms-resources at the command line.

ProcedureTo Delete a Connection Factory or Destination Resource

Use the delete-jms-resource subcommand in remote mode to remove the specified connection factory or destination resource.

Before You Begin

Ensure that you remove all references to the specified JMS resource before running this subcommand.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. List the existing JMS resources by using the list-jms-resources(1) subcommand.

  3. Delete the JMS resource by using the delete-jms-resource(1) subcommand.


Example 19–9 Deleting a JMS Resource

This example deletes the jms/Queue resource.


asadmin> delete-jms-resource jms/Queue
Command delete-jms-resource executed successfully

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help delete-jms-resource at the command line.