Websphere MQ Queue
Administration:
This section looks at how we manage WebSphere MQ queues once a
Queue Manager has been created and started. We cover defining, displaying, and
deleting Local Queues.
How to Create/define a Local Queue?
The following table shows all the possible parameters, and their
possible values, which can be specifed when creating a Local Queue. The example
following the table shows a typical defnition of a Local Queue
DEFINE QLOCAL(<qname>)
|
||
CMDSCOPE(' '/<qmgr-name>/*)
|
DEFBIND(OPEN/NOTFIXED)
|
QDPMAXEV(ENABLED/ ENABLED)
|
QSGDISP(QMGR/ COPY/
GROUP/SHARED)
|
DEFSOPT(SHARED/EXCL)
|
QSVCIEV(NONE/HIGH/ OK)
|
LIKE (<qlocalname>)
|
DISTL(NO/YES)
|
QSVCINT(999,999,999/ <int>)
|
NOREPLACE/ REPLACE
|
GET(ENABLED/DISABLED)
|
RETINTVL(999,999,999/ <int>)
|
DEFPRTY(0/<int>)
|
NOHARDENBO/HARDENBO
|
SCOPE(QMGR/CELL)
|
DEFPSIST(NO/YES)
|
INDXTYPE(NONE/MSGID/
CORRELID/GROUPID/
MSGTOKEN)
|
SHARE/NOSHARE
|
DESCR('<desc>')
|
INITQ(' '/<string>)
|
STATQ(QMGR/OFF/ON)
|
PUT(ENABLED/ DISABLED)
|
MAXDEPTH(5000/<int>)
|
STGCLASS('DEFAULT'/ <string>)
|
ACCTQ(QMGR/ON/ OFF)
|
MAXMSGL(4,194,304/<int>)
|
TRIGDATA(' '/<string>)
|
BOQNAME(' '/<string>)
|
MONQ(QMGR/OFF/LOW/ MEDIUM/HIGH)
|
TRIGDPTH(1/<int>)
|
BOTHRESH(0/<int>)
|
MSGDLVSQ(PRIORITY/FIFO)
|
NOTRIGGER/TRIGGER
|
CFSTRUCT(' '/<name>)
|
NPMCLASS(NORMAL/ HIGH)
|
TRIGMPRI(0/<int>)
|
CLUSNL(' '/<name>)
|
PROCESS(' '/<string>)
|
TRIGTYPE(FIRST/EVERY/
DEPTH/NONE)
|
CLUSTER(' '/<name>)
|
QDEPTHHI(80/<int>)
|
USAGE(NORMAL/XMITQ)
|
CLWLPRTY(0/<int>)
|
QDEPTHLO(40/<int>)
|
|
CLWLRANK(0/<int>)
|
QDPHIEV(DISABLED/ ENABLED)
|
|
CLWLUSEQ(QMGR/ ANY/
LOCAL)
|
QDPLOEV(DISABLED/ ENABLED)
|
|
The content of the text file that we pipe into
the MQSC environment
to create a Local Queue is shown next. This example shows how to create the
Administration Queue for Q Capture:
DEFINE QLOCAL(CAPA.ADMINQ) +
REPLACE +
DESCR('LOCAL DEFN OF ADMINQ FOR CAPA CAPTURE') +
PUT(ENABLED) +
GET(ENABLED) +
SHARE +
DEFSOPT(SHARED) +
DEFPSIST(YES)
REPLACE +
DESCR('LOCAL DEFN OF ADMINQ FOR CAPA CAPTURE') +
PUT(ENABLED) +
GET(ENABLED) +
SHARE +
DEFSOPT(SHARED) +
DEFPSIST(YES)
Two attributes for which
we are accepting the default values are:
·
MAXMSGL: The Maximum Message Length. This value specifes the maximum message
length of messages (in bytes) allowed in queues for this Queue Manager. The
default value is 4,194,304 bytes.
·
MAXDEPTH: The Maximum queue depth. This value specifes the maximum number
of messages allowed in the Queue. The default value is 5,000.
The definition of a Dead
Letter Queue follows this format, as it is just a Local Queue. So to define a
Dead Letter Queue for Queue Manager QMA we would code:
DEFINE QLOCAL(DEAD.LETTER.QUEUE.QMA) +
REPLACE +
DESCR('LOCAL DEAD LETTER QUEUE QMA') +
PUT(ENABLED) +
GET(ENABLED) +
SHARE +
DEFSOPT(SHARED) +
DEFPSIST(YES)
REPLACE +
DESCR('LOCAL DEAD LETTER QUEUE QMA') +
PUT(ENABLED) +
GET(ENABLED) +
SHARE +
DEFSOPT(SHARED) +
DEFPSIST(YES)
Remember that the name
of the Dead Letter Queue is the name that was specified when the Queue Manager
was created, see the Create/start/stop a Queue Manager section.
How to display the attributes of a Local Queue?
We use the DIS QLOCAL MQSC command to display the attributes of a
Local Queue. If we want to display the value of one attribute, then we just
have to append that attribute name to the command. For example, to check the
current depth of the Receive Queue issue the DIS QLOCAL (DIS QL) MQSC command with the CURDEPTH option:
: dis ql(CAPA.TO.APPB.RECVQ) CURDEPTH
To check if there are
any messages in the Dead Letter Queue issue the following MQSC command:
: dis ql(DEAD.LETTER.QUEUE.QMA) CURDEPTH
How to alter the attributes of a Queue?
There are two ways of altering the attributes of a Queue, which
are shown next:
·
Using the ALTER QLOCAL (ALTER QL) MQSC command: The following command changes a single
attribute, that of the maximum message length (MAXMSGL) – all the
other attributes remain the same:
: alter ql(CAPA.ADMINQ) MAXMSGL(10000)
·
Using the DEFINE QLOCAL MQSC command with the REPLACE option:
: define ql(CAPA.ADMINQ) MAXMSGL(10000) replace
How to empty a Local Queue?
To delete messages from
a queue (clear it down), use the CLEAR QLOCAL MQSC command:
: clear qlocal(CAPA.ADMINQ)
How to delete a Local Queue?
To delete a Local Queue,
use the DELETE QLOCAL MQSC
command:
: delete qlocal(CAPA.ADMINQ) purge
One of the options of
the command is NOPURGE (default) / PURGE. This option specifes whether any existing
committed messages on the queue are to be purged for the command to work: NOPURGEmeans that the deletion is not to go ahead if
there are any committed messages on the queue. PURGEmeans that the deletion is to go ahead even if
there are committed messages in the queue, and these messages are also to be
purged.
How to define a Remote Queue?
An example of creating a Remote Queue on QMA is shown next. Pipe the following text
into the MQSC environment on QMA:
DEFINE QREMOTE (CAPA.TO.APPB.SENDQ.REMOTE) +
REPLACE +
DESCR('REMOTE DEFN OF SEND QUEUE FROM CAPA TO APPB') +
PUT(ENABLED) +
XMITQ(QMB.XMITQ) +
RNAME(CAPA.TO.APPB.RECVQ) +
RQMNAME(QMB) +
DEFPSIST(YES)
REPLACE +
DESCR('REMOTE DEFN OF SEND QUEUE FROM CAPA TO APPB') +
PUT(ENABLED) +
XMITQ(QMB.XMITQ) +
RNAME(CAPA.TO.APPB.RECVQ) +
RQMNAME(QMB) +
DEFPSIST(YES)
The parameters for the
command are discussed in the core values fgure in the MQ Queues section.
How to define a Model Queue?
An example of creating a Model Queue on QMA is shown next. Pipe the following text
into the MQSCenvironment
on QMA:
DEFINE QMODEL (IBMQREP.SPILL.MODELQ) +
REPLACE +
DEFSOPT(SHARED) +
MAXDEPTH(500000) +
MSGDLVSQ(FIFO) +
DEFTYPE(PERMDYN)
REPLACE +
DEFSOPT(SHARED) +
MAXDEPTH(500000) +
MSGDLVSQ(FIFO) +
DEFTYPE(PERMDYN)
How to define a Transmission Queue?
A Transmission Queue is
a form of Local Queue which has its USAGE attribute set toMQUS_TRANSMISSION rather than MQUS_NORMAL.
When sending messages to
a Remote Queue defned in a local WebSphere MQ server, we need to create a Sender Channel and a Transmission Queue. A Transmission Queue can be defned to start
automatically. The following definition would be defned on QMA and is a Transmission Queue to Queue
Manager QMB:
DEFINE QLOCAL(QMB.XMITQ) +
REPLACE +
DESCR('TRANSMISSION QUEUE TO QMB') +
USAGE(XMITQ) +
PUT(ENABLED) +
GET(ENABLED) +
TRIGGER +
TRIGTYPE(FIRST) +
TRIGDATA(QMA.TO.QMB) +
INITQ(SYSTEM.CHANNEL.INITQ)
REPLACE +
DESCR('TRANSMISSION QUEUE TO QMB') +
USAGE(XMITQ) +
PUT(ENABLED) +
GET(ENABLED) +
TRIGGER +
TRIGTYPE(FIRST) +
TRIGDATA(QMA.TO.QMB) +
INITQ(SYSTEM.CHANNEL.INITQ)
To start the Sender Channel automatically when a message shows up
the Transmission Queue, triggering control of the Transmission Queue must be
confgured properly—this is what the last four lines of code achieve.
How to list Queues?
We use the DISPLAY QLOCAL and DISPLAY QREMOTE MQSC commands to list
out the Local and Remote Queues for a Queue Manager:
: dis ql(*)
: dis qr(*)
: dis qr(*)
Comments