Using triggering with the Request sample

To run the sample using triggering, start the trigger server program, AMQ3SRV4, against the required initiation queue in one job, then start AMQ3REQ4 in another job. This means that the trigger server is ready when the Request sample program sends a message.

Notes:

  1. The samples use the SYSTEM SAMPLE TRIGGER queue as the initiation queue for SYSTEM.SAMPLE.ECHO, SYSTEM.SAMPLE.INQ, or SYSTEM.SAMPLE.SET local queues. Alternatively, we can define your own initiation queue.

  2. The sample definitions created by AMQSAMP4 cause the C version of the sample to be triggered. If you want to trigger the RPG version, change the process definitions SYSTEM.SAMPLE.ECHOPROCESS and SYSTEM.SAMPLE.INQPROCESS and SYSTEM.SAMPLE.SETPROCESS. We 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.

  3. You need to compile the trigger server program from the source provided in QMQMSAMP/QRPGLESRC.

Depending on the trigger process you want to run, AMQ3REQ4 should be called with the parameter specifying request messages to be placed on one of these sample server queues:

A flow chart for the SYSTEM.SAMPLE.ECHO program is shown in Figure 1. Using the example the command to issue the RPG program request to this server is:

   CALL PGM(QMQMSAMP/AMQ3REQ4) PARM('SYSTEM.SAMPLE.ECHO
   + 30 blank characters','Queue_Manager_Name')

because the queue name and queue manager name must be 48 characters in length.

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, we can try the following variations:

  • Use AMQ3TRG4 instead of AMQ3SRV4 to submit the job instead, but potential job submission delays could make it less easy to follow what is happening.

  • Use the SYSTEM.SAMPLE.INQ and SYSTEM.SAMPLE.SET sample queues. Using the example data file the commands to issue the RPG program requests to these servers are, respectively:

       CALL PGM(QMQMSAMP/AMQ3INQ4) PARM('SYSTEM.SAMPLE.INQ
       + 31 blank characters')
       CALL PGM(QMQMSAMP/AMQ3SET4) PARM('SYSTEM.SAMPLE.SET
       + 31 blank characters')

    because the queue name must be 48 characters in length.

    These sample queues also have a trigger type of FIRST.