DB2 10.5 for Linux, UNIX, and Windows

db2mqlsn - MQListener command

Invokes the asynchronous MQListener to monitor a set of WebSphere® MQ message queues, passing messages that arrive on them to configured DB2® stored procedures. It can also perform associated administrative and configuration tasks.

MQListener configuration information is stored in a DB2 database and consists of a set of named configurations, including a default. Each configuration is composed of a set of tasks. MQListener tasks are defined by the message queue from which to retrieve messages and the stored procedure to which they will be passed. The message queue description must include the name of the message queue and its queue manager, if it is not the default. Information about the stored procedure must include the database in which it is defined, a user name and password with which to access the database, and the procedure name and schema.

On Linux and UNIX operating systems, this utility is located in the DB2DIR/instance directory, where DB2DIR is the location where the current version of the DB2 database product is installed.

On Windows operating systems, this utility is located in the DB2PATH\sqllib\bin directory, where DB2PATH is the location where the current version of the DB2 database product is installed.

For more information about controlling access to WebSphere MQ objects, refer to the WebSphere MQ System Administration Guide (SC34-6068-00).

Authorization

Command syntax

Read syntax diagramSkip visual syntax diagram
>>-db2mqlsn----------------------------------------------------->

>--+-help--+---------+--------------------------------+--------><
   |       '-command-'                                |   
   +-run--| configuration |--| run parameters |-------+   
   +-add--| configuration |--| add parameters |-------+   
   +-remove--| configuration |--| remove parameters |-+   
   +-show--| configuration |--------------------------+   
   '-admin--| admin parameters |----------------------'   

configuration

|-- -configDB--configuration database name---------------------->

>--+----------------------------------------------+------------->
   '- -configUser--user ID-- -configPwd--password-'   

>--+------------------------------+-----------------------------|
   '- -config--configuration name-'   

run parameters

|--+----------------------------------------------------------------------+--|
   '- -adminQueue--admin queue name--+----------------------------------+-'   
                                     '- -adminQMgr--admin queue manager-'     

add parameters

|-- -inputQueue--input queue name--+------------------------------------+-->
                                   '- -queueManager--queue manager name-'   

>-- -procSchema--stored procedure schema-- -procName--stored procedure name-->

>-- -dbName--stored procedure database--+--------------------------------------+-->
                                        '- -dbUser--user ID-- -dbPwd--password-'   

>--+-----------------+------------------------------------------>
   '- -mqCoordinated-'   

>--+--------------------------------------------+---------------|
   '- -numInstances--number of instances to run-'   

remove parameters

|-- -inputQueue--input queue name--+------------------------------------+--|
                                   '- -queueManager--queue manager name-'   

admin parameters

|--+- -adminQueue--admin queue name------------------+--+----------------------------------+-->
   '- -adminQueueList--namelist of admin queue names-'  '- -adminQMgr--admin queue manager-'   

>-- -adminCommand--+-shutdown-+---------------------------------|
                   '-restart--'   

Command parameters

help command
Supplies detailed information about a particular command. If you do not give a command name, then a general help message is displayed.
-configDB configuration database
Name of the database that contains the configuration information.
-configUser user ID -configPwd password
Authorization information with which to access the configuration database.
-config configuration name
You can group individual tasks into a configuration. By doing this you can run a group of tasks together. If you do not specify a configuration name, then the utility runs the default configuration.
run
-adminQueue admin queue name -adminQMgr admin queue manager
This is the queue on which the MQListener listens for administration commands. If you do not specify a queue manager, then the utility uses the configured default queue manager. If you do not specify an adminQueue, then the application does not receive any administration commands (such as shutdown or restart) through the message queue.
add
-inputQueue input queue name -queueManager queue manager name
This is the queue on which the MQListener listens for messages for this task. If you do not specify a queue manager, the utility uses the default queue manager configured in WebSphere MQ.
-procSchema stored procedure schema -procName stored procedure name
The stored procedure to which MQListener passes the message when it arrives.
-dbName stored procedure database
MQListener passes the message to a stored procedure. This is the database in which the stored procedure is defined.
-dbUser user ID -dbPwd password
The user on whose behalf the stored procedure is invoked.
-mqCoordinated
This indicates that reading and writing to the WebSphere MQ message queue should be integrated into a transaction together with the DB2 stored procedure call. The entire transaction is coordinated by the WebSphere MQ coordinator. (The queue manager must also be configured to coordinate a transaction in this way. See the WebSphere MQ documentation for more information.) By default, the message queue operations are not part of the transaction in which the stored procedure is invoked.
-numInstances number of instances to run
The number of duplicate instances of this task to run in this configuration. If you do not specify a value, then only one instance is run.
remove
-inputQueue input queue name -queueManager queue manager name
This is the queue and queue manager that define the task that will be removed from the configuration. The combination of input queue and queue manager is unique within a configuration.
admin
-adminQueue admin queue name -adminQueueList namelist of admin queue names -adminQMgr admin queue manager
The queue or namelist of queue names on which to send the admin command. If you do not specify a queue manager, the utility uses the default queue manager that is configured in WebSphere MQ.
-adminCommand admin command
Submits a command. The command can be either shutdown or restart. shutdown causes a running MQListener to exit when the listener finishes processing the current message. restart performs a shutdown, and then reads the configuration again and restarts.

Examples

db2mqlsn show -configDB sampleDB -config nightlies
db2mqlsn add -configDB sampleDB -config nightlies -inputQueue app3
-procSchema imauser -procName proc3 -dbName aDB -dbUser imauser -dbPwd aSecret
db2mqlsn run -configDB -config nightlies