Create JMS objects

To create JMS connection factory and destination objects and store them in a JNDI namespace, use the DEFINE verb. To store your objects in an LDAP environment, we must give them names that comply with certain conventions. The administration tool can help you obey LDAP naming conventions by adding a default prefix to object names.


The DEFINE verb creates an administered object with the type, name and properties that you specify. The new object is stored in the current context.

The names of JMS objects that are stored in an LDAP environment must comply with LDAP naming conventions. One of these conventions is that object and context names must include a prefix, such as cn= (common name), or ou= (organizational unit). The administration tool simplifies the use of LDAP service providers by allowing you to refer to object and context names without a prefix. If we do not supply a prefix, the tool automatically adds a default prefix to the name you supply. For LDAP, this is cn=. If required, we can change the default prefix by setting the NAME_PREFIX property in the configuration file. For more information, see Configure the JMS administration tool.

Note: We might need to configure your LDAP server to store Java objects. For more information, see the documentation for the LDAP server.


Procedure

  1. If the administration tool is not already started, start it as described in Starting the administration tool. The command prompt is displayed, indicating that the tool is ready to accept administration commands.
  2. Make sure that command prompt is showing the context in which we want to create the new object. When you start the administration tool, the prompt initially appears as:
    InitCtx>
    
    To change the current context, use the CHANGE verb as described in Configure subcontexts.
  3. To create a connection factory, queue destination or topic destination, use the following command syntax:
    DEFINE TYPE (name) [property]*
    

    That is, type the DEFINE verb, followed by a TYPE (name) administered object reference, followed by zero or more properties (see Properties of IBM MQ classes for JMS objects ).

  4. To create a connection factory, queue destination or topic destination, use the following command syntax:
    DEFINE TYPE (name) [property]*
    
  5. To display the newly created object, use the DISPLAY verb with the following command syntax:
    DISPLAY TYPE (name)
    


Example

The following example shows a queue called testQueue created in the initial context using the DEFINE verb. Since this object is being stored in an LDAP environment, although the object name testQueue is not entered with a prefix, the tool automatically adds one to ensure compliance with the LDAP naming convention. Submitting the command DISPLAY Q(testQueue) also causes this prefix to be added.
InitCtx> DEFINE Q(testQueue)

InitCtx> DISPLAY CTX

Contents of InitCtx

a cn=testQueue       com.ibm.mq.jms.MQQueue

1 Object(s)
0 Context(s)
1 Binding(s), 1 Administered

Parent topic: Configure JMS objects using the administration tool