Configuring MQListener tasks
As part of configuring MQListener in Db2 for z/OS®, you must configure at least one MQListener task.
About this task
Use MQListener command db2mqln1 or db2mqln2 to configure MQListener tasks. Issue the command from the z/OS UNIX System Services command line in any directory. Alternatively, you can put the command in a file, grant execute permission on the file, and use the BPXBATCH utility to invoke the command using JCL. Sample script files are provided and are located in the /mqlistener-install-path/mqlsn/listener/script directory in z/OS UNIX System Services. Sample JCL is also provided in member DSNTEJML of data set prefix.SDSNSAMP. When you run MQListener commands, configuration information is stored in the Db2 table SYSMQL.LISTENERS.
The command parameters are:
- -adminQueue
- The queue to which MQListener listens for administration commands. If
-adminQueue is not specified, applications do not receive any administration
commands through the message queue.
- -adminQMgr
- The name of the IBM® MQ subsystem that contains the queues that are to be used for administrative tasks. If -adminQMgr is not specified, the configured default queue manager is used.
- -config
- A name that identifies a group of tasks that run together. If -config is not specified, the
default configuration is run.
- -queueManager
- The name of the IBM MQ subsystem that contains the queues that are to be used. If -queueManager is not specified, is not specified, the default queue manager is used.
- -inputQueue
- The name of the queue in the IBM MQ subsystem that is to be monitored for incoming messages. The combination of the -inputQueue value and the -queueManager value must be unique within a configuration.
- -numInstances
- The number of duplicate instances of a single task that are to run in a configuration.
- -numMessagesCommit
- The number of messages that are received before MQListener issues a COMMIT. The default is 1. This option is supported only for db2mqln2.
- -procName
- The name of the stored procedure that MQListener calls when it detects that a message is received.
- -procSchema
- The schema name of the stored procedure that MQListener calls when it detects that a message is received.
- -ssID
- The subsystem where the MQListener daemon runs. Configuration information is stored in this subsystem.
- -timeRestart
- If a stored procedure that is specified by -procSchema and -procName fails at MQListener startup time, the number of seconds that threads that are running with that stored procedure suspend before repeating the setup process. MQListener continues startup for threads that do not use that stored procedure. This value must be an integer in the range 0–7200. 0 is the default.
- -restartDB2
- Whether MQListener automatically reconnects and resumes processing after Db2 is stopped and restarted.
- 'Y'
- MQListener automatically reconnects and resumes processing after Db2 is stopped and restarted.
- 'N'
- MQListener does not automatically reconnect after Db2 is stopped and restarted. 'N' is the default value.
The syntax of the commands follows. In the command syntax, mqlistener-command
is db2mqln1
or db2mqln2
.
- To add an MQListener configuration, issue the mqlistener-command
add command:
mqlistener-command add -ssID subsystem-name -config configuration-name -queueManager queuemanager-name -inputQueue inputqueue-name -procName stored-procedure-name -procSchema stored-procedure-schema name -numInstances number-of-instances
- To display information about the configuration, issue the following
mqlistener-command
show command:
To display information about all the configurations, issue the mqlistener-command show command:mqlistener-command show -ssID subsystem-name -config configuration-name
mqlistener-command show -ssID subsystem-name -config all
- To remove the messaging tasks, issue the mqlistener-command
remove command:
mqlistener-command remove -ssID subsystem-name -config configuration-name -queueManager queuemanager-name -inputQueue inputqueue-name
- To run the MQListener task, issue the mqlistener-command
run command:
mqlistener-command run -ssID subsystem-name -config configuration-name -adminQueue adminqueue-name -adminQMgr adminqueuemanager-name -numMessagesCommit number-of-messages-before-commit -timeRestart number-of-seconds-to-suspend-before-restart -restartDB2 y-or-n
- To shutdown the MQListener daemon, issue the mqlistener-command
admin command:
mqlistener-command admin -adminQueue adminqueue-name -adminQMgr adminqueuemanager-name -adminCommand shutdown
- To restart the MQListener daemon, issue the following command:
mqlistener-command mqlistener-command admin -adminQueue adminqueue-name -adminQMgr adminqueuemanager-name -adminCommand restart
- To get help with the command and the valid parameters, issue the
mqlistener-command
help command:
mqlistener-command help
- To get help for a particular parameter, issue the mqlistener-command
help command, where command is a specific parameter:
mqlistener-command help command
- Use the same queue manager for the request queue and the reply queue.
- MQListener does not support logical messages that are composed of multiple physical messages. MQListener processes physical messages independently.