The publish/subscribe installation verification test

The publish/subscribe installation verification test (PSIVT) program is supplied only in compiled form. It is in the com.ibm.mq.jms package.

The PSIVT requires a suitable publish/subscribe broker that is running. See Additional setup for publish/subscribe mode for a list of the supported publish/subscribe brokers and instructions on how to start each of them.

The PSIVT attempts to:

  1. Create a publisher, p, publishing on the topic MQJMS/PSIVT/Information
  2. Create a subscriber, s, subscribing on the topic MQJMS/PSIVT/Information
  3. Use p to publish a simple text message
  4. Use s to receive a message waiting on its input queue

When you run the PSIVT, the publisher publishes the message, and the subscriber receives and displays the message. The publisher publishes to the broker's default stream. The subscriber is non-durable, does not perform message selection, and accepts messages from local connections. It performs a synchronous receive, waiting a maximum of 5 seconds for a message to arrive.

You can run the PSIVT, like the IVT, in either JNDI mode or standalone mode. JNDI mode uses JNDI to retrieve a TopicConnectionFactory and a Topic from a JNDI namespace. If JNDI is not used, these objects are created at runtime.

Publish/subscribe verification without JNDI

A script named PSIVTRun (PSIVTRun.bat on Windows systems) is provided to run PSIVT. The file is in the bin subdirectory of the installation.

To run the test without JNDI, issue the following command:

PSIVTRun -nojndi [-m <qmgr>] [-bqm <broker>] [-t]

For client mode, to run the test without JNDI, issue the following command:

PSIVTRun -nojndi -client -m <qmgr> -host <hostname> [-port <port>] 
                [-channel <channel>] [-bqm <broker>] [-t]

where:

-nojndi
indicates no JNDI lookup of the administered objects
qmgr
is the name of the queue manager to which you wish to connect
hostname
is the host on which the queue manager is running
port
is the TCP/IP port on which the queue manager's listener is running (default 1414)
channel
is the client connection channel (default SYSTEM.DEF.SVRCONN)
broker
is the name of the remote queue manager on which the broker is running. If this is not specified, the value used for qmgr is assumed.
-t
turns tracing on (default is off)

If the test completes successfully, output is similar to the following:

5724-H72, 5655-L82, 5724-L26 (c) Copyright IBM Corp. 2002,2005. All Rights Reserved.
Websphere MQ classes for Java(tm) Message Service 6.0
Publish/Subscribe Installation Verification Test

Creating a TopicConnectionFactory
Creating a Connection
Creating a Session
Creating a Topic
Creating a TopicPublisher
Creating a TopicSubscriber
Creating a TextMessage
Adding text
Publishing the message to topic://MQJMS/PSIVT/Information
Waiting for a message to arrive [5 secs max]...

Got message:
JMS Message class: jms_text
  JMSType:         null
  JMSDeliveryMode: 2
  JMSExpiration:   0
  JMSPriority:     4
  JMSMessageID:    ID:414d5120514d5f63616c6c616e6169734286ac4120002304
  JMSTimestamp:    1102075124453
  JMSCorrelationID:AMQ QM_callanais 
  JMSDestination:  topic://MQJMS/PSIVT/Information
  JMSReplyTo:      null
  JMSRedelivered:  false
  JMS_IBM_PutDate:20041203
  JMSXAppID:QM_callanais
  JMS_IBM_Format:MQSTR
  JMS_IBM_PutApplType:26
  JMS_IBM_MsgType:8
  JMSXUserID:mwhite
  JMS_IBM_PutTime:11584446
  JMSXDeliveryCount:1
A simple text message from the MQJMSPSIVT program
Reply string equals original string
Closing TopicSubscriber
Closing TopicPublisher
Closing Session
Closing Connection
PSIVT finished

Publish/subscribe verification with JNDI

To run the PSIVT in JNDI mode, two administered objects must be retrievable from a JNDI namespace:

You can define these objects by using the WebSphere MQ JMS Administration Tool (see Using the WebSphere MQ JMS administration tool) and using the following commands:

DEFINE TCF(ivtTCF)

This command defines the TopicConnectionFactory.

DEFINE T(ivtT) TOPIC(MQJMS/PSIVT/Information)

This command defines the Topic.

These definitions assume that a default queue manager, on which the broker is running, is available. For details on configuring these objects to use a non-default queue manager, see Administering JMS objects. These objects must reside in a context pointed to by the -url command-line parameter described below.

To run the test in JNDI mode, enter the following command:

PSIVTRun [ -t ]  -url "<providerURL>" [ -icf <initCtxFact> ]

where:

-t
means turn tracing on (by default, tracing is off)
providerURL
Note:
Enclose the providerURL string in quotation marks (").
This is the JNDI location of the administered objects. If the default initial context factory is in use, this is an LDAP URL of the form:
"ldap://hostname.company.com/contextName"

If a file system service provider is used, (see initCtxFact below), the URL is of the form:

"file://directorySpec"
initCtxFact
is the classname of the initial context factory. The default is for an LDAP service provider, and has the value:
com.sun.jndi.ldap.LdapCtxFactory

If a file system service provider is used, set this parameter to:

com.sun.jndi.fscontext.RefFSContextFactory

If the test completes successfully, output is similar to the non-JNDI output, except that the create QueueConnectionFactory and Queue lines indicate retrieval of the object from JNDI.

PSIVT error recovery

If the test is not successful, note the following: