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

  • All options except db2mqlsn admin access the MQListener configuration in the configDB database. The connection is made as configUser or, if no user is specified, an implicit connection is attempted. The user in whose name the connection is made must have EXECUTE privilege on package mqlConfi.
  • To access MQ objects with the db2mqlsn run and db2mqlsn admin options, the user who executes the program must be able to open the appropriate MQ objects.
  • To execute the db2mqlsn run option successfully, the dbUser specified in the db2mqlsn add option that created the task must have EXECUTE privilege on the specified stored procedure, and must have EXECUTE privilege on the package mqlRun in the dbName database.

Command syntax

Read syntax diagramSkip visual syntax diagramdb2mqlsnhelpcommandrunconfigurationrun parametersaddconfigurationadd parametersremoveconfigurationremove parametersshowconfigurationadminadmin parameters
configuration
Read syntax diagramSkip visual syntax diagram-configDBconfiguration database name -configUseruser ID-configPwdpassword-configconfiguration name
run parameters
Read syntax diagramSkip visual syntax diagram-adminQueueadmin queue name-adminQMgradmin queue manager
add parameters
Read syntax diagramSkip visual syntax diagram-inputQueueinput queue name -queueManagerqueue manager name -procSchemastored procedure schema -procNamestored procedure name -dbNamestored procedure database -dbUseruser ID-dbPwdpassword -mqCoordinated-numInstancesnumber of instances to run
remove parameters
Read syntax diagramSkip visual syntax diagram -inputQueueinput queue name -queueManagerqueue manager name
admin parameters
Read syntax diagramSkip visual syntax diagram -adminQueueadmin queue name-adminQueueListnamelist of admin queue names -adminQMgradmin queue manager -adminCommand shutdownrestart

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