Saturday 11 January 2014

Dead Letter Handler Configuration Using Service Object

Configuring the DLQ Handler as a server service object:
To run the DLQ handler as a service, you need to define a server service object in that queue manager. This example uses a batch file and rules table for the DLQ Handler.

Step:1 Configure Dead Letter Queue For Queue Manager:

Define QLocal(DEAD.QUEUE) LIKE(SYSTEM.DEAD.LETTER.QUEUE)

ALTER QMGR DEADQ(DEAD.QUEUE)

ALTER QL(LOCAL-QUEUE-NAME) MAXDEPTH(5)

Step:2 Create Batch File

Contents of dlqhandler.bat

cd "C:\Program Files\IBM\WebSphere MQ\bin"
runmqdlq %1 %2 %3

The rules table should be defined with some REASON and ACTION sequence and WAIT (YES), which means that the DLQ Handler waits indefinitely for further messages to arrive on the DLQ.

Step:3 Rules table Content : File Name is-- RULETBL.RUL

WAIT(YES) RETRYINT(20)
REASON(*) ACTION(FWD/RETRY/DISCARD/IGNORE) FWDQ('QUEUENAME') FWDQM('QMGRNAME')

Step:4 Define server service object for DLQ Handler

DEFINE SERVICE(dlqhandler) +
SERVTYPE(SERVER) +
CONTROL(QMGR) +
STARTCMD('C:\IBM\WebSphere\MQ\dlqhandler.bat') +
DESCR('dead letter queue handler as server service') +
STARTARG('DEADQ IBMQMR < C:\IBM\WebSphere\MQ\RULETBL.RUL') +
STDOUT('C:\IBM\WebSphere\MQ\Log.txt') +
STDERR('C:\IBM\WebSphere\MQ\Err.txt') +
REPLACE

You can set CONTROL to MANUAL, QMGR, or STARTONLY based on your requirements. The value of STARTCMD is the absolute path of the executable file dlqhandler.bat (on Windows).

Step:5 Start Service:
Start service(dlqhandler)

Step:6 Display Service Status:
Display SVStatus(dlqhandler)

Step:7 Send 10 Messages From Source 

5 messages are get stored on local queue
5 messages are get stored on DEAD.QUEUE.
Retrieve messages on local queue. dead letter handler will process messages to local queue. 

Best Regards,
MADHU K
IBM MQ Certified Professional
HYDERABAD
+917893751171/+919964371404
mailme.mq@gmail.com
trainingontech.com
http://www.ibmmqadmin-madhu.blogspot.in