Create and configure JMS administered objects

We can use IBM MQ Explorer to configure the JMS administered objects that enable communication between Java applications and IBM MQ.


The Java Message Service (JMS) is a Java API that allows applications that are written in Java to the JMS specification to communicate with any messaging product that implements the JMS API. Because the JMS API is an open standard and has multiple implementations, we can select which messaging provider (the JMS provider) to use according to we requirements.

IBM MQ is a JMS provider; it provides a messaging system that implements the JMS API. We can use the IBM MQ graphical user interface, IBM MQ Explorer, to configure the JMS administered objects that enable communication between the Java application (the JMS client) and IBM MQ (the JMS provider).

There are two types of JMS administered objects in IBM MQ classes for JMS:

  • Connection factories, which the JMS client uses to create connections to the JMS provider.
  • Destinations, which the JMS client uses to represent the target and source of messages.

The administered objects are stored in a naming and directory service that is accessed by IBM MQ Explorer using the Java Naming Directory Interface (JNDI) API. The administered objects are stored in locations on the naming and directory service known as the JNDI namespaces. There are various JNDI service providers that we can use as the naming and directory service, including Lightweight Directory Access Protocol (LDAP) and local or remote file systems.

Because the JMS client uses the JMS administered objects to connect to the JMS provider, you configure the administered objects to define how the JMS client sends and receives, or publishes and subscribes, messages. The JMS client does not directly communicate with the JMS provider and is unaware of which JMS provider is being used. This means that we can change the JMS provider without having to update the JMS client.

To configure IBM MQ classes for JMS so that a JMS client can connect to and access administered objects in a JNDI namespace, we must perform the following tasks in IBM MQ Explorer:


Procedure

  1. Connect to the JNDI namespace. For more information, see Adding an initial context.
  2. Create and configure the administered objects that are stored in the JNDI namespace. For more information, see Create a connection factory and Create a destination.


Results

For more information about programming JMS applications and configuring IBM MQ classes for JMS, see Use IBM MQ classes for JMS.

  • JMS contexts
    A context is a set of bindings that associates names with objects stored in a naming and directory service.
  • JMS connection factories
    A connection factory is an object that a JMS client (a JMS program that uses the JMS API) uses to create a connection with a JNDI provider (a messaging provider such as IBM MQ).
  • JMS destinations (queues and topics)
    A JMS destination is an object (a JMS queue or a JMS topic) that represents the target of messages that the client produces and the source of messages that the client consumes. In point-to-point messaging, destinations represent queues; in publish/subscribe messaging, destinations represent topics.
  • Messaging providers for IBM MQ classes for JMS
    A JMS client (a Java application that uses the JMS API) uses a connection factory to create a connection with the JMS provider. The messaging provider that is used as the JMS provider determines which types of transport are available to use for the connection.
  • Adding an initial context
    To create and configure JMS objects in IBM MQ Explorer, we must add an initial context to define the root of the JNDI namespace in which the JMS objects are stored in the naming and directory service.
  • Connect and disconnecting an initial context
    We can connect or disconnect IBM MQ Explorer to an initial context that is displayed in the JMS Administered Objects folder. We can also configure each initial context so that IBM MQ Explorer automatically reconnects to it the next time that you close and restart IBM MQ Explorer.
  • Removing an initial context
    If you no longer want to access and administer JMS objects in a particular JNDI namespace, we can remove the initial context that defines the root of the JNDI namespace from the JMS Administered Objects folder in IBM MQ Explorer.
  • Create a connection factory
    A JMS client (a Java application that uses the JMS API) uses connection factories to create connections to the JMS provider (a messaging provider such as IBM MQ).
  • Create a destination
    A JMS client uses a destination object to specify the target of messages that the JMS client produces and the source of messages that the JMS client receives. Destination objects can represent queues (for point-to-point messaging) or topics (for publish/subscribe messaging).
  • Create a JMS object and an IBM MQ object simultaneously
    When creating a new JMS object, we can optionally create a corresponding IBM MQ object of the same type.
  • Create a JMS object from an IBM MQ object
    We can create new JMS administered objects based on your existing IBM MQ objects.
  • Copy an administered object
    To copy an administered object in IBM MQ Explorer, you create a new object based on the existing object that we want to copy.
  • Change the transport type used for connections
    We can change the transport type that a JMS client uses to connect to a JMS provider. We might also need to change any properties and settings that are required by the new transport type.
  • Create a subcontext
    A subcontext is a subdivision of a JNDI namespace and can contain connection factories and destinations as well as other subcontexts. We can create subcontexts within initial contexts or within other subcontexts.
  • Renaming an administered object
    When you have created an administered object (connection factories and destinations), we can subsequently rename it in IBM MQ Explorer.
  • Renaming a context
    We can rename a subcontext, provided that we have first deleted from the subcontext any objects that are stored in the subcontext.
  • Delete an administered object
    When you delete an administered object in IBM MQ Explorer, the administered object no longer exists in the JNDI namespace in the naming and directory service.
  • Delete a subcontext
    When you delete a subcontext in IBM MQ Explorer, the subcontext no longer exists in the JNDI namespace.

Parent topic: Introduction to IBM MQ Explorer


Related concepts