Author |
Message
|
fjb_saper |
Posted: Tue Nov 18, 2003 11:24 am Post subject: Triggering and windows 2000 |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
I am trying to set up a trigger to start a stand alone Java application on an at first type triggering.
The trigger monitor is set up on the initiation queue
the process is set up although I will need help with passing 2 parms to the command line of the xxx.bat being called
the Initiation queue is fine
The trigger message never gets written
No information in system log
Version = Websphere MQ v 5.3
OS = Window 2000
Any ideas ?
Thanks
F.J. |
|
Back to top |
|
 |
vennela |
Posted: Tue Nov 18, 2003 12:00 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Have you turned the TRIGGER on on the pertaining queue.
Did you start the trigger montior. If yes, how, command line or GUI?
Quote: |
the process is set up although I will need help with passing 2 parms to the command line of the xxx.bat being called |
Can you explain what you mean. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Nov 18, 2003 1:27 pm Post subject: Triggering and windows 2000 |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Hi Vennela,
All set up has been done via the MMC Gui and verified using runmqsc.
Trigger attribute is being displayed on the queue.
Trigger monitor was created and started in MQ Services MMC and is shown to be running.
But nothing is happening... no trigger message
no error popup (swing) for the missing parms in the java app.
As for the command line parms:
Here is what is written in the .bat file
java mypackage.Myclass %1 %2
where %1 is the Queue manager name
and %2 is the queue name that got the message the process needs to read.
How can I pass this information through the process to the java app?
The java app has been tested from the command line and works fine.  |
|
Back to top |
|
 |
vennela |
Posted: Tue Nov 18, 2003 3:27 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Quote: |
Trigger monitor was created and started in MQ Services MMC and is shown to be running. |
Try running this in a command window
You can use runmqtrm to start the trigger monitor.
Quote: |
java mypackage.Myclass %1 %2 |
You can hard code the Queue Name and QMGR name I guess.
I have never done this but you may also use USERDATA filed of the PROCESS definition to pass the values as parameters to your application. |
|
Back to top |
|
 |
clindsey |
Posted: Tue Nov 18, 2003 5:55 pm Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
Since you are trying to pass the qmgr and queue as parms, you can read this from the trigger messages. Have a look at the sample I put in this thread. It will show you how to access it:
http://www.mqseries.net/phpBB2/viewtopic.php?t=10574&highlight=java+trigger+sample
I believe you said your trigger is set up as FIRST. If there are messages on the queue already, then putting additional message on the queue will not initiate a trigger message. If you think you have everything set up, try purging all messages on the queue, start the trigger monitor, and then put a message on the queue and see if it triggers. Venny makes a good point that during debug you should start the trigger monitor from a command prompt so you can see any diagnostic information on the window.
Charlie |
|
Back to top |
|
 |
JasonE |
Posted: Wed Nov 19, 2003 2:20 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
As per a previous append - try running the trigger monitor in a command window while you are debugging this as you can both see the logged output and it also avoids a number of security related problems which lots of people hit.
Triggering from the service based runmqtrm requires the musr_mqadmin account (or whatever account MQ runs under) to have READ access to the root of the drive containing the app, and the root of the drive containing the windows dir (its one or the other, I can never remember which). This is an o/s restriction, not an MQ one. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Nov 19, 2003 6:31 am Post subject: Triggering and windows 2000 |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
I run runmqtrm from the command prompt and I got the prompt waiting for a trigger message.
Whenever I put a message into my queue (after clearing all messages) nothing at all happens on the triggering front. Nothing is changed in the command window.
Can anybody help me understand what is missing and how I can solve it ?
Thanks
F.J. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Nov 19, 2003 6:49 am Post subject: Triggering and windows 2000 |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
I finally got the syntax right in the command window
Had to change the path to the executable *.bat to a path without spaces (substituting 8 char names where necessary xxx~y) and added the parms on the command line for the exec.
What I was hoping to do was have variables i.e. 1 process valid for triggering multiple queues and substiture the queue name when being called. Apparently that won't work.
Thanks a lot.
Now if anybody could explain how to run a correct triggermonitor from the Services MMC I'd be grateful.
Thanks again
F.J. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Nov 19, 2003 6:55 am Post subject: Re: Triggering and windows 2000 |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
fjb_saper wrote: |
What I was hoping to do was have variables i.e. 1 process valid for triggering multiple queues and substiture the queue name when being called. Apparently that won't work.
|
The first command line argument passed to a triggered process by the IBM supplied trigger monitors is an MQ_TMC2 structure. This structure contains the name of the queue that was triggered, if I recall correctly. Check the Application Programming Reference for the TMC and TMC2 structures. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Nov 24, 2003 7:27 am Post subject: Triggering and windows 2000 |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Thanks Jeff.
Your post helped a lot to resolve my second problem as the parameters were all in the TMC2 Structure. By the way I could not find a Java class to handle the structure and ended building my own. If anybody is interested ?
here is the Java code I wrote for handling MQTMC2
Thanks again
Code: |
package mqxmlsap;
import java.io.*;
import java.util.*;
/**
* @author Administrator
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class MQTMC2 {
private static final int bsize = 732;
private byte[] value = null;
/**
* Constructor for MQTMC2.
*/
public MQTMC2() {
super();
value = new byte[bsize];
for (int i = 0; i < bsize; i++) {
value[i] = (byte) ' ';
} //end for
} //end constr
public MQTMC2(String mqtcm2) {
super();
value = new byte[bsize];
for (int i = 0; i < bsize; i++) {
value[i] = (byte) ' ';
} //end for
byte[] myval = mqtcm2.getBytes();
for (int i = 0; i < myval.length && i < bsize; i++) {
value[i] = myval[i];
} //endfor
} //end constructor
private String getString(int stpos, int len) {
String retstring = null;
byte[] bval = new byte[len];
int endpos = stpos + len;
for (int i = stpos; i < endpos && i < bsize; i++) {
bval[i - stpos] = value[i];
} //end for
retstring = new String(bval);
return retstring;
} //endmethod
public String getStrucId() {
return getString(0, 4);
} //end method
public String getVersion() {
return getString(4, 4);
} //end method
public String getQName() {
String retval = getString(8, 48);
return retval.trim();
} //end method
public String getProcessName() {
String retval = getString(54, 48);
return retval.trim();
} //end method
public String getTriggerData() {
String retval = getString(102, 64);
return retval.trim();
} //end method
public String getApplType() {
return getString(168, 4);
} //end method
public String getApplId() {
String retval = getString(172, 256);
return retval.trim();
} //end method
public String getEnvData() {
String retval = getString(428, 128);
return retval.trim();
} //end method
public String getUserData(){
String retval = getString(556, 128);
return retval.trim();
}//end method
public String getQMgrName(){
String retval = getString(684, 48);
return retval.trim();
}//end Method
} //end class
|
|
|
Back to top |
|
 |
clindsey |
Posted: Mon Nov 24, 2003 9:55 am Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
Too bad. If you had clicked on the link I gave you above, it had the code for an MQTrigger class. Could have saved you a little time.
Charlie |
|
Back to top |
|
 |
|