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 test requires a broker such as the MQSeries Publish/Subscribe broker (SupportPac MA0C) or WebSphere MQ Integrator V2 to be installed and running.

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 NT) 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
means 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
means turn tracing on (default is off)

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

5648-C60, 5724-B41, 5655-F10 (c) Copyright IBM Corp. 2002. All Rights Reserved.
Websphere MQ classes for Java(tm) Message Service 5.300
Publish/Subscribe Installation Verification Test
 
Creating a Connection
Creating a TopicConnectionFactory
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:414d51204153434152492020202020207cce883c19230020
  JMSTimestamp:    1016124933637
  JMSCorrelationID:ID:414d51204153434152492020202020207cce883c09320020
  JMSDestination:  topic://MQJMS/PSIVT/Information
  JMSReplyTo:      null
  JMSRedelivered:  false
  JMS_IBM_PutDate:20020314
  JMSXAppID:ASCARI                      
  JMS_IBM_Format:MQSTR   
  JMS_IBM_PutApplType:26
  JMS_IBM_MsgType:8
  JMSXUserID:parkiw      
  JMS_IBM_PutTime:16553367
  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 Chapter 5, 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 should 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
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
Note:
Enclose the providerURL string in quotation marks (").

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, the following notes may be helpful:



© IBM Corporation 1997, 2002. All Rights Reserved