DB2 MQ services
A service describes a destination to which an application sends messages or from which an application receives messages. DB2® MQ services are defined in the DB2 table SYSIBM.MQSERVICE_TABLE. When an application program invokes a DB2 MQ function, the program selects a service from SYSIBM.MQSERVICE_TABLE by specifying it as a parameter.
The SYSIBM.MQSERVICE_TABLE is automatically created by DB2, but once created, it is user-managed and typically maintained by a system administrator. DB2 initially provides a row for the default service. The default service is DB2.DEFAULT.SERVICE.
A new service can be added simply by issuing an INSERT
statement. For example, the following statement adds a new service
called MYSERVICE. The MQ default queue manager and the MYQUEUE input
queue will be used for this new service.
INSERT INTO SYSIBM.MQSERVICE_TABLE (SERVICENAME, QUEUEMANAGER, INPUTQUEUE)
VALUES('MYSERVICE', SPACE(48), 'MYQUEUE')
A service can be changed (including the default service)
simply by issuing an UPDATE statement. For performance reasons, DB2 caches the service information
so any existing job that has already used an MQ function will typically
not detect a concurrent change to a service. The following statement
updates the service called MYSERVICE by changing the input queue to
MYQUEUE2.
UPDATE SYSIBM.MQSERVICE_TABLE
SET INPUTQUEUE = 'MYQUEUE2'
WHERE SERVICENAME = 'MYSERVICE'
Note: The default
input queue initially used by the default service DB2.DEFAULT.SERVICE is the MQ model queue called
SYSTEM.DEFAULT.LOCAL.QUEUE. The default input queue used by other DB2 products is DB2MQ_DEFAULT_Q.
For compatibility with other DB2 products,
you may wish to create a new input queue called DB2MQ_DEFAULT_Q and
update the default service. For example:
CL: CRTMQMQ QNAME(DB2MQ_DEFAULT_Q) QTYPE(*LCL);
UPDATE SYSIBM.MQSERVICE_TABLE
SET INPUTQUEUE = 'DB2MQ_DEFAULT_Q'
WHERE SERVICENAME = 'DB2.DEFAULT.SERVICE'
