Running the Request sample using triggering
If the sample is used with triggering and one of the Inquire, Set, or Echo
sample programs, the line of input must be the queue name of the queue that
you want the triggered program to access.
UNIX(R) systems, and Windows systems
To run the samples using triggering:
- Start the trigger monitor program RUNMQTRM in one session (the initiation
queue SYSTEM.SAMPLE.TRIGGER is available for you to use).
- Start the amqsreq program in another session.
- Make sure that you have defined a target server queue.
The sample queues
available to you to use as the target server queue for the request sample
to put messages are:
- SYSTEM.SAMPLE.INQ - for the Inquire sample program
- SYSTEM.SAMPLE.SET - for the Set sample program
- SYSTEM.SAMPLE.ECHO - for the Echo sample program
These queues have a trigger type of FIRST, so if there are already messages
on the queues before you run the Request sample, server applications are not
triggered by the messages you send.
- Make sure that you have defined a queue for the Inquire, Set or Echo sample
program to use.
This means that the trigger monitor is ready when the request sample sends
a message.
Note:
The sample process definitions created using RUNMQSC and the
amqscos0.tst file trigger the C samples. Change the process definitions in
amqscos0.tst and use RUNMQSC with this updated file to use COBOL versions.
Figure 36 demonstrates how to use the Request and Inquire
samples together.
In Figure 36 the Request sample puts messages onto the target
server queue, SYSTEM.SAMPLE.INQ, and the Inquire sample queries the queue,
MYQUEUE. Alternatively, you can use one of the sample queues defined when
you ran amqscos0.tst, or any other queue that you have defined, for the Inquire
sample.
Note:
The numbers in
Figure 36 show the sequence of
events.
To run the Request and Inquire samples, using triggering:
- Check that the queues that you want to use are defined. Run amqscos0.tst,
to define the sample queues, and define a queue MYQUEUE.
- Run the trigger monitor command RUNMQTRM:
RUNMQTRM -m qmanagername -q SYSTEM.SAMPLE.TRIGGER
- Run the request sample
amqsreq SYSTEM.SAMPLE.INQ
Note:
The process object defines what is to be triggered. If the client and server
are not running on the same platform, any processes started by the trigger
monitor must define
ApplType, otherwise the server takes
its default definitions (that is, the type of application that is normally
associated with the server machine) and causes a failure.
For a list of
application types, see the WebSphere MQ Application Programming Reference.
-
Enter the name of the queue that you want the Inquire sample
to use:
MYQUEUE
- Enter a blank line (to end the Request program).
- The request sample will then display a message, containing the data the
Inquire program obtained from MYQUEUE.
You can use more than one queue; in this case, enter the names of the other
queues at step 4.
For more information on triggering see Starting WebSphere MQ applications using triggers.
i5/OS
To try the samples using triggering on i5/OS, start the sample trigger
server, AMQSERV4, in one job, then start AMQSREQ4 in another. This means that
the trigger server is ready when the Request sample program sends a message.
Notes:
- The sample definitions created by AMQSAMP4 trigger the C versions of the
samples. If you want to trigger the COBOL versions, change the process definitions
SYSTEM.SAMPLE.ECHOPROCESS, SYSTEM.SAMPLE.INQPROCESS, and SYSTEM.SAMPLE.SETPROCESS.
You can use the CHGMQMPRC command (described in the WebSphere MQ for iSeries V6 System Administration Guide) to
do this, or edit and run your own version of AMQSAMP4.
- Source code for AMQSERV4 is supplied for the C language only. However,
a compiled version (that you can use with the COBOL samples) is supplied in
library QMQM.
You could put your request messages on these sample server queues:
- SYSTEM.SAMPLE.ECHO (for the Echo sample programs)
- SYSTEM.SAMPLE.INQ (for the Inquire sample programs)
- SYSTEM.SAMPLE.SET (for the Set sample programs)
A flow chart for the SYSTEM.SAMPLE.ECHO program is shown in Figure 37.
Using the example data file the command to issue the C program request to
this server is:
CALL PGM(QMQMSAMP/AMQSREQ4) PARM('QMQMSAMP/AMQSDATA(ECHO)')
Note:
This sample queue has a trigger type of FIRST, so if there
are already messages on the queue before you run the Request sample, server
applications are not triggered by the messages you send.
If you want to attempt further examples, you can try the following variations: