Author |
Message
|
jayk0120 |
Posted: Tue Jan 24, 2006 10:03 am Post subject: MQ Event Triggering |
|
|
Novice
Joined: 08 Dec 2005 Posts: 12
|
Hi everyone..
I was wondering if there any way to configure MQ such that it can trigger an event on its own when it receives a message? That is, I do NOT want to use the MDB approach where a listener port is constantly polling for a message and then triggers the onMessage. Instead I would like MQ to create its on event so that it can automatically called the program that will process the incoming message. Is there a way way to do this? I hope I am making sense of what I am trying to achieve.
Could anyone please let me know? If any of you guys have seen this scenario, and have sort of an example code or a good reference that would help a lot!!
Thanks much in advance!
Jay |
|
Back to top |
|
 |
mvic |
Posted: Tue Jan 24, 2006 10:16 am Post subject: Re: MQ Event Triggering |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
jayk0120 wrote: |
Could anyone please let me know? If any of you guys have seen this scenario, and have sort of an example code or a good reference that would help a lot!! |
It takes a bit of effort to set it all up correctly, but MQ can do this : http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/topic/com.ibm.mq.csqzal.doc/csq0322.htm Read carefully - when (if?) it doesn't work, I recommend re-reading the sections entitled "Prerequisites for triggering" and "Conditions for a trigger event". |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jan 24, 2006 12:11 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
One thing to note about triggering compared to MDB is that triggering starts a new JVM, where as an MDB fires an event inside an existing JVM. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mvic |
Posted: Tue Jan 24, 2006 1:57 pm Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
jefflowrey wrote: |
One thing to note about triggering compared to MDB is that triggering starts a new JVM, where as an MDB fires an event inside an existing JVM. |
This can be avoided, by avoiding writing programs in Java  |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jan 24, 2006 2:39 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
mvic wrote: |
This can be avoided, by avoiding writing programs in Java  |
Only in a sense.
Triggering always creates a new process. Sometimes that new process is a JVM, and sometimes it's not.
But one would think that jayk0120 wouldn't be concerned about processes that weren't JVMs, when posting to the Java/JMS forum.
But jayk0120 might be very interested to know that triggering isn't a mechanism for invoking an action inside an existing JVM like an app server. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mvic |
Posted: Tue Jan 24, 2006 2:55 pm Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
jefflowrey wrote: |
But one would think that jayk0120 wouldn't be concerned about processes that weren't JVMs, when posting to the Java/JMS forum.
But jayk0120 might be very interested to know that triggering isn't a mechanism for invoking an action inside an existing JVM like an app server. |
Both very good points, I agree. |
|
Back to top |
|
 |
jayk0120 |
Posted: Wed Jan 25, 2006 12:21 am Post subject: |
|
|
Novice
Joined: 08 Dec 2005 Posts: 12
|
Actually you are right...I want the triggering to invoke a java procedure/program(EJB) that lies within an application running under Websphere Application server.
Are you saying this is not possible? Is there a workaround?
Please let me know.
Thanks
Jay |
|
Back to top |
|
 |
mvic |
Posted: Wed Jan 25, 2006 3:01 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
jayk0120 wrote: |
Actually you are right...I want the triggering to invoke a java procedure/program(EJB) that lies within an application running under Websphere Application server. |
If you want to stay inside J2EE then use the JMS facility provided - which is onMessage. I'm not aware of any other J2EE or app server facilities for what you want to do ("would like MQ to create its on event so that it can automatically called the program that will process the incoming message.") - but as I said, I'm not the expert on this.
Could you be a little more explicit about the reasons why onMessage is a problem - you mentioned polling, but what is there about polling that causes a problem? |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jan 25, 2006 4:52 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
It is possible to use a MessageListener instead of an MDB.
It is possible to use triggering to start a separate JVM that then called an EJB running in WAS. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
jayk0120 |
Posted: Wed Jan 25, 2006 11:35 am Post subject: |
|
|
Novice
Joined: 08 Dec 2005 Posts: 12
|
Quote: |
It is possible to use triggering to start a separate JVM that then called an EJB running in WAS. |
Do you guys know where I can find an example of using triggering to do the above?
In fact any example of how to setup triggering would help. I looked at the link on the IBM website that you guys listed, but that alone is not helping me setup and test an example.
Could you please let me know? Thanks again! |
|
Back to top |
|
 |
vennela |
Posted: Wed Jan 25, 2006 11:58 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jan 25, 2006 1:35 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
jayk0120 wrote: |
Quote: |
It is possible to use triggering to start a separate JVM that then called an EJB running in WAS. |
Do you guys know where I can find an example of using triggering to do the above?
In fact any example of how to setup triggering would help. I looked at the link on the IBM website that you guys listed, but that alone is not helping me setup and test an example.
Could you please let me know? Thanks again! |
http://www.nynjmq.org/Triggering%20the%20right%20Java%20Environment.zip
You will have to have your standalone java prgm call into the WAS jvm (rmi) and trigger your ejb. If you run a J2EE client be aware that the jars needed on the classpath are nearly as heavy as the stuff to run WAS...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
jayk0120 |
Posted: Thu Jan 26, 2006 8:53 am Post subject: |
|
|
Novice
Joined: 08 Dec 2005 Posts: 12
|
thanks for all ur replies so far.
I created an initiation queue and application queue..also i created a process object which points to the application but I am not sure if I m doing this correctly?
DEFINE PROCESS ('RUNSAMPLE') +
REPLACE +
DESCR ('process description') +
APPLTYPE () +
APPLICID ('C:\MQ\RunSample.bat') +
USERDATA '')
do I enter the entire path to the batch file that runs the program in the APPLICID parameter? I just want to test a sample bat program which calls an EJB running on WAS under Windows..For some reason when I try to put a message on the appln queue, the triggering message doesnt appear on the initiation queue even though I set up the conditions for triggering correctly. I really wish I had a running sample code to look at..that would be a gr8 help! |
|
Back to top |
|
 |
wschutz |
Posted: Thu Jan 26, 2006 9:08 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Quote: |
I try to put a message on the appln queue, the triggering message doesnt appear on the initiation queue even though I set up the conditions for triggering correctly |
You'll never "see" the message on the init q. If a trigger monitor doesn't have the init q open, the queue manager doesn't generate a message for the initq. If the initq is open, the trigger monitor (usually) gets it immediately.
There is a good section in the APG about the conditions required for triggering, you should consult that, basically, they are:
1. Have a INITQ defined
2. set the initq name in you application queue
3. Have a process defined
4. set the process name in your application queue
5. set trigtype on your applcaiotn queue
6. enable triggering on your appl queue
7. have a trigger monitor (TM) running....
You should see an IPPROCS of 1 on your INITQ if the TM is running. You can also run the TM in the foreground to see if its able to launch your program.... _________________ -wayne |
|
Back to top |
|
 |
mvic |
Posted: Thu Jan 26, 2006 9:15 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
|
Back to top |
|
 |
|