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:
- Create a publisher, p, publishing on the topic MQJMS/PSIVT/Information
- Create a subscriber, s, subscribing on the topic MQJMS/PSIVT/Information
- Use p to publish a simple text message
- 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:
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:
- A TopicConnectionFactory bound under the name ivtTCF
- A Topic bound under the name ivtT
You can define these objects by 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:
where:PSIVTRun [ -t ] -url "<providerURL>" [ -icf <initCtxFact> ]
- -t
- means turn tracing on (by default, tracing is off)
- providerURL
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:
- Note:
- Enclose the providerURL string in quotation marks (").
"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.LdapCtxFactoryIf a file system service provider is used, set this parameter to:
com.sun.jndi.fscontext.RefFSContextFactoryIf 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:
- The following message:
*** No broker response. Please ensure broker is running. ***indicates that the broker is installed on the target queue manager, but its control queue contains some outstanding messages. For instructions on how to start it, see Additional setup for publish/subscribe mode.
- If the following message is displayed:
Unable to connect to queue manager: <default>ensure that your WebSphere MQ system has configured a default queue manager.
- If the following message is displayed:
Unable to connect to queue manager: ...ensure that the administered TopicConnectionFactory that the PSIVT uses is configured with a valid queue manager name. Alternatively, if you used the -nojndi option, ensure that you supplied a valid queue manager (using the -m option).
- If the following message is displayed:
Unable to access broker control queue on queue manager: ... Please ensure the broker is installed on this queue managerensure that the administered TopicConnectionFactory that the PSIVT uses is configured with the name of the queue manager on which the broker is installed. If you used the -nojndi option, ensure that you supplied a queue manager name (using the -m option).
WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.