Author |
Message
|
Jaykris |
Posted: Wed Jan 10, 2007 10:36 pm Post subject: Triggering a C# application from MQ |
|
|
Newbie
Joined: 27 Dec 2006 Posts: 3
|
I'm trying to create a listener in C#.NET for an IBM MQ . I have a program that can get messages from a queue until the queue is empty .In order to implement a listener ,i need to trigger this program every time a message is out in the queue.
Can anyone tel me how i can associate my C# application to the trigger on my queue so that it is called everytime a message comes to my queue ?? I see that there are attributes called process name and trigger data of the queue.But how do i use them to associate my .net application to the queue ?? |
|
Back to top |
|
 |
Mr Butcher |
Posted: Wed Jan 10, 2007 11:33 pm Post subject: |
|
|
 Padawan
Joined: 23 May 2005 Posts: 1716
|
did you read "starting Websphere MQ applications using triggers" in the application programmers guide? _________________ Regards, Butcher |
|
Back to top |
|
 |
Jaykris |
Posted: Thu Jan 11, 2007 1:01 am Post subject: creating a process definition |
|
|
Newbie
Joined: 27 Dec 2006 Posts: 3
|
Yes i have . It describes the process very well but since i am new to IBM MQ , i did not understand how the process definition is created. Can it be done programmatically in my MQ application using the API or is it created using Websphere ?? I looked around for some pointers on using the API classes but drew a blank. Can you help ?
How do i create a process definition and set its attributes for my queue ? |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jan 11, 2007 1:08 am Post subject: Re: creating a process definition |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Jaykris wrote: |
How do i create a process definition and set its attributes for my queue ? |
Using the procedure outlined in the System Administration manual & others. You'll find DEFINE PROCESS documented not far from the DEFINE QUEUE command, which talks about process & tirgger attributes.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Jaykris |
Posted: Thu Jan 11, 2007 1:31 am Post subject: |
|
|
Newbie
Joined: 27 Dec 2006 Posts: 3
|
Sorry , this might sound a little dumb but im using a Windows system with .net . I still dont understand if the process is a websphere object .
The Application PRogramming guide gives the following code for creating a process definition in CL is :
CRTMQMPRC PRCNAME(’SYSTEM.SAMPLE.INQPROCESS’)
+ REPLACE(*YES) + MQMNAME + TEXT(’trigger process for AMQSINQA’)
+ ENVDATA(’JOBPTY(3)’) /* Submit parameter */
+ APPID(’AMQSINQA’) /* Program name */
How do i do this using C# ? Is it possible using the API ? |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jan 11, 2007 1:38 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Jaykris wrote: |
Sorry , this might sound a little dumb but im using a Windows system with .net . I still dont understand if the process is a websphere object .
The Application PRogramming guide gives the following code for creating a process definition in CL is :
CRTMQMPRC PRCNAME(’SYSTEM.SAMPLE.INQPROCESS’)
+ REPLACE(*YES) + MQMNAME + TEXT(’trigger process for AMQSINQA’)
+ ENVDATA(’JOBPTY(3)’) /* Submit parameter */
+ APPID(’AMQSINQA’) /* Program name */
How do i do this using C# ? Is it possible using the API ? |
Why, exactly, are you quoting an example from the manual which refers to iSeries if you're using Windows???  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jan 11, 2007 1:43 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
I think you'd be better served reading the section rather than picking likely sounding bits out of it, and sticking to examples concerning Windows. The z/OS & iSeries platforms have rather different command interfaces and syntax to the rest of the distributed platforms and are not transportable.
If you cast your eye a little further down from the example you quote, you'll see the manual recommend you use DEFINE PROCESS on Windows and UNIX.
Just like I did. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 11, 2007 4:08 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You need to understand the differences between a triggered application and a listener application.
A listener application is one that runs all the time and is constantly in a GET with WAIT statement to recieve any new message that appears on a queue.
A triggered application is one that is started by WebSphere MQ when certain conditions on a particular queue are met. A triggered application will read the queue until the queue is empty and then exit.
If you want MQ to start your program, you need to tell MQ where your program is and how to trigger it. This can be done using code - but should not be done INSIDE your program - as how will your program ever get started?
If you are a developer, you really should be asking your MQ Administrators for help with this. They will be the ones that will eventually have to install your program into the production environment and the ones that will eventually have to configure MQ to start your program in the production environment. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|