Design of the triggering sample

 

The triggering sample program opens the initiation queue using the MQOPEN call with the MQOO_INPUT_AS_Q_DEF option. It gets messages from the initiation queue using the MQGET call with the MQGMO_ACCEPT_TRUNCATED_MSG and MQGMO_WAIT options, specifying an unlimited wait interval. The program clears the MsgId and CorrelId fields before each MQGET call to get messages in sequence.

When it has retrieved a message from the initiation queue, the program tests the message by checking the size of the message to make sure that it is the same size as an MQTM structure. If this test fails, the program displays a warning.

For valid trigger messages, the triggering sample copies data from these fields: ApplicId, EnvrData, Version, and ApplType. The last two of these fields are numeric, so the program creates character replacements to use in an MQTMC2 structure for i5/OS, UNIX, and Windows systems.

The triggering sample issues a start command to the application specified in the ApplicId field of the trigger message, and passes an MQTMC2 or MQTMC (a character version of the trigger message) structure. In UNIX systems and Windows systems, the EnvData field is used as an extension to the invoking command string. In i5/OS, it is used as job submission parameters, for example, the job priority or the job description. See the WebSphere MQ for iSeries System Administration Guide for a discussion of job priority and job description.

Finally, the program closes the initiation queue.

 

Parent topic:

The Triggering sample programs


fg17660_