Running the sample program

 

You should now have an LDAP Directory Server running and populated with the sample data. The data specifies three host machines, all of which should be running WebSphere MQ servers. Ensure that the default queue manager is running on each machine (unless you changed the sample data to specify a different queue manager).

Also, start the WebSphere MQ listener program on each machine; the sample uses TCP/IP with the default WebSphere MQ port number, so we can start the listener with the command:

runmqlsr -t tcp

To test the sample, you might also want to run a program to read the messages arriving at each WebSphere MQ server, for example you could use the amqstrg sample program:

amqstrg SYSTEM.DEFAULT.LOCAL.QUEUE

The sample program uses three environment variables, one required and two optional. The required variable is LDAP_BASEDN, which specifies the base Distinguished Name for the directory search. To work with the sample data, set this to ou=Transport, o=MQuser, for example, at a command prompt on Windows systems type:

set LDAP_BASEDN=ou=Transport, o=MQuser

The optional variables are LDAP_HOST and LDAP_VERSION. The LDAP_HOST variable specifies the name of the host where the LDAP server is running; it defaults to the local host if it is not specified. The LDAP_VERSION variable specifies the version of the LDAP protocol to be used, and can be either 2 or 3. Most LDAP servers now support version 3 of the protocol; they all support the older version 2. This sample works equally well with either version of the protocol, and if it is not specified it defaults to version 2.

We can now run the sample by typing the program name followed by the name of the WebSphere MQ application that you want to send messages to, in the case of the sample data the application names are London, Sydney, and Washington. For example, to send messages to the London application:

amqsldpc London

If the program fails to connect to the WebSphere MQ server, an appropriate error message appears. If it connects successfully we can start typing messages, each line that you type (terminated by <return> or <enter>) is sent as a separate message, an empty line ends the program.

 

Parent topic:

LDAP sample program


fg16960_