The Triggering sample programs
The function provided in the triggering sample is a subset of that provided in the trigger monitor in the runmqtrm program.
See Features demonstrated in the sample programs for the names of these programs.
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 UNIX, Linux®, 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, Linux and
Windows systems,
the EnvData
field is used
as an extension to the invoking command string.
Finally, the program closes the initiation queue.