| Author | 
		  Message
		 | 
		
		  | saurabh25281 | 
		  
		    
			  
				 Posted: Sun Sep 29, 2019 1:15 pm    Post subject: Unable to run DLQ-Handler as a service | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 05 Nov 2006 Posts: 108 Location: Bangalore 
  | 
		  
		    
			  
				Hi All,
 
 
We are using MQv9.1 and trying to setup a DLQ handler as a MQ service on RHEL platform.
 
 
Below is my service definition
 
   
	| Code: | 
   
  
	DEFINE SERVICE(DLQH) +
 
SERVTYPE(SERVER) +
 
CONTROL(QMGR) +
 
STARTCMD('+MQ_INSTALL_PATH+bin/runmqdlq') +
 
DESCR('dlqhandler service') +
 
STARTARG('+QMNAME+.DLQ +QMNAME+ </home/mqm/mq-dlh/mq-dlh.rul') +
 
STOPCMD('+MQ_INSTALL_PATH+bin/amqsstop') +
 
STOPARG('-m +QMNAME+ -p +MQ_SERVER_PID+') +
 
STDOUT('/var/mqm/qmgrs/+QMNAME+/errors/dlqh.log') +
 
STDERR('/var/mqm/qmgrs/+QMNAME+/errors/dlqh.err') +
 
REPLACE | 
   
 
 
 
However, when I start the service i get the below error in the dlqh.err log.
 
   
	| Quote: | 
   
  
	AMQ8758E: 1 errors detected in input to runmqdlq.
 
AMQ8709I: Dead-letter queue handler ending. | 
   
 
 
 
As someone suggested in the link, that the above error is due to missing end-of-line in the rule table, I verified the .rul file and it had the end-of-line character. 
 
To make sure that the rule file was not the culprit, I ran the DLQ handler directly on the server as below and it worked fine.
 
   
	| Quote: | 
   
  
	/opt/mqm/bin/runmqdlq MYQMGR.DLQ MYQMGR < /home/mqm/mq-dlh/mq-dlh.rul
 
AMQ8708I: Dead-letter queue handler started to process INPUTQ(MYQMGR.DLQ). | 
   
 
 
 
Attaching my mq-dlh.rul file
 
   
	| Code: | 
   
  
	inputqm(' ')  inputq(' ')   
 
 
DESTQ(INITQ.*) FORMAT('MQTRIG  ') +
 
  REASON(MQRC_Q_FULL) ACTION(DISCARD) RETRY(5)   
 
REASON(MQRC_Q_FULL) ACTION(RETRY) RETRY(5)   
 
 
REASON(MQRC_PUT_INHIBITED) ACTION(RETRY) RETRY(5)   
 
 
MSGTYPE(MQMT_REQUEST) REPLYQM(AAAA.*) +
 
  ACTION(FWD) FWDQ(DEADQ) FWDQM(&REPLYQM)   
 
 
DESTQM(bbbb.1) +
 
  action(fwd) fwdq(&DESTQ) fwdqm(bbbb.2) header(no)   
 
 
REPLYQM(CCCC.*) + 
 
  ACTION(FWD) FWDQ(ALARM) FWDQM(CCCC.SYSTEM)
 
 
 | 
   
 
 
 
Can someone tell me where I am going wrong.
 
 
Thanks
 
Saurabh | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | exerk | 
		  
		    
			  
				 Posted: Sun Sep 29, 2019 2:11 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 02 Nov 2006 Posts: 6339
  
  | 
		  
		    
			  
				Look hard at the service definition and what you entered on the command line:
 
 
'</home/mqm/mq-dlh/mq-dlh.rul' is different to '< /home/mqm/mq-dlh/mq-dlh.rul' _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | saurabh25281 | 
		  
		    
			  
				 Posted: Sun Sep 29, 2019 3:02 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 05 Nov 2006 Posts: 108 Location: Bangalore 
  | 
		  
		    
			  
				
   
	| exerk wrote: | 
   
  
	Look hard at the service definition and what you entered on the command line:
 
 
'</home/mqm/mq-dlh/mq-dlh.rul' is different to '< /home/mqm/mq-dlh/mq-dlh.rul' | 
   
 
 
The space after '<' doesn't make any difference to the outcome i.e.
 
1. If i remove the space after < in command line, it still works.
 
2. If i add a space in the service definition after <, it still doesn't work.
 
 
Regards
 
Saurabh | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | gbaddeley | 
		  
		    
			  
				 Posted: Sun Sep 29, 2019 4:13 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	| STARTARG('+QMNAME+.DLQ +QMNAME+ </home/mqm/mq-dlh/mq-dlh.rul') + | 
   
 
 
Does startarg actually support a stdin specification???
 
 
We don't invoke 'runmqdlq' directly, its inside a wrapper script.
 
Also, we use a process object rather than service object, which is triggered by first msg on the DLQ. It waits 60 secs for new msgs then terminates. _________________ Glenn | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | HubertKleinmanns | 
		  
		    
			  
				 Posted: Sun Sep 29, 2019 11:33 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Shaman
 
 Joined: 24 Feb 2004 Posts: 732 Location: Germany 
  | 
		  
		    
			  
				In the past on Windows the rule table required an empty line after the last rule at the end of the file. I don't know if this is still necessary. _________________ Regards
 
Hubert | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | exerk | 
		  
		    
			  
				 Posted: Sun Sep 29, 2019 11:41 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 02 Nov 2006 Posts: 6339
  
  | 
		  
		    
			  
				gbaddeley, good point! Like you I use a wrapper script and have used a triggered DLQ in the past. Depending on customer requirement/request/mandate, I now use either, or manual intervention.
 
 
saurabh25281, if you wish it to be a Service definition, try:
 
 
   
	| Code: | 
   
  
	STARTCMD('/home/mqm/mq-dlh/mq-dlh.sh') +
 
STARTARG('+QMNAME+.QUEUE +QMNAME+ /home/mqm/mq-dlh/mq-dlh.rul') | 
   
 
 
 
The content of the script can be as simple as:
 
 
   
	| Code: | 
   
  
	#!/bin/bash
 
echo $1 $2 $3
 
echo Started `date '+%Y%m%d %H%M%S'`
 
runmqdlq $1 $2 < $3 | 
   
 
 
 
And in the rules file:
 
 
   
	| Code: | 
   
  
	* Control Information
 
 
RETRYINT(30) WAIT(YES)
 
 
* Specific Rules
 
(Your rules here) | 
   
 
 _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | exerk | 
		  
		    
			  
				 Posted: Sun Sep 29, 2019 11:45 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 02 Nov 2006 Posts: 6339
  
  | 
		  
		    
			  
				
   
	| HubertKleinmanns wrote: | 
   
  
	| In the past on Windows the rule table required an empty line after the last rule at the end of the file. I don't know if this is still necessary. | 
   
 
 
According to THIS, yes. For portability I always include a blank line in Unix-based rules files too as it doesn't seem to make any difference to its operation. _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bruce2359 | 
		  
		    
			  
				 Posted: Mon Sep 30, 2019 3:37 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Poobah
 
 Joined: 05 Jan 2008 Posts: 9486 Location: US: west coast, almost. Otherwise, enroute. 
  | 
		  
		    
			  
				
   
	| exerk wrote: | 
   
  
	
   
	| HubertKleinmanns wrote: | 
   
  
	| In the past on Windows the rule table required an empty line after the last rule at the end of the file. I don't know if this is still necessary. | 
   
 
 
According to THIS, yes. For portability I always include a blank line in Unix-based rules files too as it doesn't seem to make any difference to its operation. | 
   
 
 
The (platfiorm-specific) requirement was for an and-of-line CR/LF (or equivalent) on the last line. _________________ I like deadlines. I like to wave as they pass by.
 
ב''ה
 
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | HubertKleinmanns | 
		  
		    
			  
				 Posted: Mon Sep 30, 2019 3:56 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Shaman
 
 Joined: 24 Feb 2004 Posts: 732 Location: Germany 
  | 
		  
		    
			  
				
   
	| bruce2359 wrote: | 
   
  
	
   
	| exerk wrote: | 
   
  
	
   
	| HubertKleinmanns wrote: | 
   
  
	| In the past on Windows the rule table required an empty line after the last rule at the end of the file. I don't know if this is still necessary. | 
   
 
 
According to THIS, yes. For portability I always include a blank line in Unix-based rules files too as it doesn't seem to make any difference to its operation. | 
   
 
 
The (platfiorm-specific) requirement was for an and-of-line CR/LF (or equivalent) on the last line. | 
   
 
 
 
That's what IBM writes in the knowledge center: 
   
	| Quote: | 
   
  
	| On Windows systems, the last rule in the table must end with a carriage return/line feed character. You can achieve this by ensuring that you press the Enter key at the end of the rule, so that the last line of the table is a blank line. | 
   
 
 
So an empty line doesn't hurt  . _________________ Regards
 
Hubert | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | saurabh25281 | 
		  
		    
			  
				 Posted: Mon Sep 30, 2019 3:59 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 05 Nov 2006 Posts: 108 Location: Bangalore 
  | 
		  
		    
			  
				1. I tried creating the MQ service in my Windows machine with startarg and it worked perfectly fine. So I guess it should work Linux too.
 
   
	| Code: | 
   
  
	SERVICE(S1)                             CONTROL(MANUAL)
 
SERVTYPE(SERVER)
 
STARTCMD(C:\Users\myuser\Documents\runmqdlq\mqdlqh.bat)
 
STARTARG(DLQ QM2 <C:\Users\myuser\Documents\runmqdlq\dlh.rul)
 
STOPCMD(+MQ_INSTALL_PATH+bin64\amqsstop)
 
STOPARG(-m +QMNAME+ -p +MQ_SERVER_PID+) | 
   
 
 
   
	| Code: | 
   
  
	| runmqdlq.exe %1 %2 %3 | 
   
 
 
 
2. We want to trigger the runmqdlq directly, not as a wrapper, because we want to configure the stop service as well.
 
If we use a wrapper, the stop services is passed with the process id of the wrapper script which the MQ queue manager service amqsstop can't stop.
 
 
3. Most of the blogs or knowledge articles I have seen use services for invoking the DLQ-Handler. Below are few of them.
 
https://developer.ibm.com/answers/questions/333874/how-do-i-configure-the-dead-letter-queue-handler-r/
 
https://www.ibm.com/developerworks/websphere/library/techarticles/1204_gupta/1204_gupta.html
 
Again, we chose this option, because we don't want the Handler triggered, but always running as a service.
 
 
4. Like I said, i ensured that the end-of-line character is present in the .rul file, but it didnt make any difference and the service would not start. Even though my platform is Linux, i added the end of line and it should not make any difference. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | HubertKleinmanns | 
		  
		    
			  
				 Posted: Mon Sep 30, 2019 4:36 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Shaman
 
 Joined: 24 Feb 2004 Posts: 732 Location: Germany 
  | 
		  
		    
			  
				On Linux you should replace the backslashes ("\") by slashes ("/") _________________ Regards
 
Hubert | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | HubertKleinmanns | 
		  
		    
			  
				 Posted: Mon Sep 30, 2019 4:37 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Shaman
 
 Joined: 24 Feb 2004 Posts: 732 Location: Germany 
  | 
		  
		    
			  
				And I guess you won't have a directory starting with "C:" ... _________________ Regards
 
Hubert | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | saurabh25281 | 
		  
		    
			  
				 Posted: Mon Sep 30, 2019 4:46 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 05 Nov 2006 Posts: 108 Location: Bangalore 
  | 
		  
		    
			  
				
   
	| HubertKleinmanns wrote: | 
   
  
	And I guess you won't have a directory starting with "C:" ...
 
On Linux you should replace the backslashes ("\") by slashes ("/") | 
   
 
 
Please check my initial post. All the Linux/platform based consideration are taken care off.
 
 
Regards
 
Saurabh | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | tczielke | 
		  
		    
			  
				 Posted: Mon Sep 30, 2019 4:49 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Guardian
 
 Joined: 08 Jul 2010 Posts: 943 Location: Illinois, USA 
  | 
		  
		    
			  
				If you do the following:
 
 
1) strmqtrc -m qmgr -t all -p runmqdlq
 
2) cause runmqdlq to run
 
3) endmqtrc -a
 
4) dspmqtrc - for your trace file
 
 
you may get a trace that has more details as to why the AMQ8758E is being reported.
 
 
If you use the od command (octal dump) on your mq-dlh.rul file to print the bytes of the file, it might show some helpful diagnostic information, too. _________________ Working with MQ since 2010. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Mon Sep 30, 2019 4:55 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				you did not specify what the access to the rule file was...   _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |