TopicLoad.java

 

This class is a JMS application that is a publish/subscribe version of the Load2 queue loader described in Load2.java. It publishes the required number of messages under the given topic, then terminates. Each message contains a user property called value, which takes a randomly selected integer value between 0 and 100.

To use this application, ensure that the broker is running and that the required setup is complete. For details, see Additional setup for publish/subscribe mode.

This application has two versions of the command line syntax.

For use with JNDI, the syntax is:

java -Djava.library.path=library_path
     TopicLoad [-icf jndiICF] [-url jndiURL] [-tcfLookup tcfLookup]
               [-tLookup tLookup] [-sleep sleepTime] [-msgs numMsgs]
where library_path is the path to the WebSphere MQ Java libraries (see The WebSphere MQ Java libraries).

For use without JNDI, the syntax is:

java -Djava.library.path=library_path
     TopicLoad -nojndi [-qmgr qMgrName] [-t tName]
                       [-sleep sleepTime] [-msgs numMsgs]

Table 1 describes the parameters and gives their defaults.

TopicLoad parameters and defaults
Parameter Meaning Default
jndiICF Initial context factory class used for JNDI com.sun.jndi.ldap.LdapCtxFactory
jndiURL Provider URL used for JNDI ldap://localhost/o=ibm,c=us
tcfLookup JNDI lookup key used for TopicConnectionFactory cn=tcf
tLookup JNDI lookup key used for Topic cn=t
qMgrName Name of queue manager to connect to, and broker queue manager to publish messages to "" (use the default queue manager)
tName Name of topic to publish to MQJMS/ASF/TopicLoad
sleepTime Time (in milliseconds) to pause between message puts 0 (no pause)
numMsgs Number of messages to put 200

If there are any errors, an error message is displayed and the application terminates.


uj25750_