JMS Resources

The Java Message Service (JMS) is a Java API that provide a common way for JAVA applications to create, send, receive and read messages in a distributed environment.

note  The term Broker refers to the software component that routes and delivers messages. The Sun ONE Message Queue (MQ) message service is bundled with the Sun ONE Application Server, and it consists of one or more Sun ONE MQ brokers. The JMS resources that you can manage are connection factories and destinations.

A connection factory is an object that a JMS client uses to create a connection with a provider. At the beginning of a JMS client program, you usually perform a JNDI API lookup of the connection factory For example, the following code fragment obtains an InitialContext object and uses it to look up the QueueConnectionFactory and the TopicConnectionFactory by name:

  Context ctx = new InitialContext();

  QueueConnectionFactory queueConnectionFactory = 
    (QueueConnectionFactory) ctx.lookup("QueueConnectionFactory");

  TopicConnectionFactory topicConnectionFactory = 
    (TopicConnectionFactory) ctx.lookup("TopicConnectionFactory");

A destination is an object that a JMS client uses to specify the target of messages it produces and the source of messages it consumes. In addition to looking up a connection factory, you usually look up a destination. For example, the following line of code performs a JNDI API lookup of the MyTopic and the MyQueue by name:

  Topic myTopic = (Topic) ctx.lookup("MyTopic");

  Queue myQueue = (Queue) ctx.lookup("MyQueue");

Creating a JMS Connection Factory Definition

To create a JMS connection factory definition:

  1. In the Explorer's Runtime tab, expand the Server Registry and expand Installed Servers and expand Sun ONE Application Server 7 node.

    note  If you do not see any Administration Server nodes, the Administration Server of the Sun ONE Application Server must be added under the Installed Servers subnode of the Server Registry node. See here for more information.

  2. Right-click the Unregistered JMS Resource node and choose Add New JMS Resource.
  3. Enter the JNDI name of this resource in the JNDI Name field.
  4. Select javax.jms.QueueConnectionFactory or javax.jms.TopicConnectionFactory in the Type field to specify point-to-point or publish/subscribe domains.
  5. Enter other properties for the JMS connection factory definition. See JMS Resource Property Sheet for more information.
  6. Once the definition is created, you must register it to the application server instance where you want to create the JMS resource. See Registering a JMS Resource Definition for more information.

Creating a JMS Destination Definition

To create a JMS destination definition:

  1. In the Explorer's Runtime tab, expand the Server Registry and expand Installed Servers and expand Sun ONE Application Server 7 node.
  2. Right-click the Unregistered JMS Resource node and choose Add New JMS Resource.
  3. Enter the JNDI name of this resource in the JNDI Name field.
  4. Select javax.jms.Topic or javax.jms.Queue in the Type field to specify point-to-point or publish/subscribe domains.
  5. Enter other properties for the JMS destination definition. See JMS Resource Property Sheet for more information.
  6. Once the definition is created, you must register it to the application server instance where you want to create the JMS resource. See Registering a JMS Resource Definition for more information.

Registering a JMS Resource Definition

To register a JMS resource definition to an application server instance:

  1. In the Explorer's Runtime tab, expand the Server Registry and expand Installed Servers and expand Sun ONE Application Server 7 and expand Unregistered JMS Resources node.
  2. Select the JMS resource definition that you want to register and choose Register. The Select Server to Register to dialog box opens.
  3. Select the application server instance where you want to create the JMS resource and click Register. The Information dialog box opens.
  4. Click OK to close the Information dialog box.
  5. Click OK to close the Select Server to Register to dialog box.
  6. To see the new JMS resource, expand the application server instance and expand Registered JMS Resources node.

Deleting a JMS Resource

To delete a JMS resource from an application server instance:

  1. In the Explorer's Runtime tab, expand the Server Registry and expand Installed Servers and expand Sun ONE Application Server 7 and expand Administration Server and expand application server instance and expand Registered JMS Resources node.
  2. Right-click the JMS resource and choose Delete.

See also
   JMS Resources Property Sheet
Registering a Resource
Server Instance

Legal Notices