Design of the Put Reference Message sample (amqsprma.c, AMQSPRM4)
This topic gives a detailed description of a Put Reference Message sample.
This sample creates a Reference Message that refers to a file and puts it on a specified queue:
- The sample connects to a local queue manager using MQCONN.
- It then opens (MQOPEN) a model queue that is used to receive report messages.
- The sample builds a Reference Message containing the values required to move the file, for example, the source and destination file names and the object type. As an example, the sample shipped with IBM® MQ builds a Reference Message to send the file
d:\x\file.infromQMGR1toQMGR2and to re-create the file asd:\y\file.outusing the following parameters:
Whereamqsprm -q QR -m QMGR1 -i d:\x\file.in -o d:\y\file.out -t FLATFILEQRis a remote queue definition that refers to a target queue onQMGR2.Note: For AIX® and Linux® platforms, use two backslashes (\\) instead of one to denote the destination file directory. Therefore, the amqsprm command looks like this:amqsprm -q QR -m QMGR1 -i /x/file.in -o d:\\y\\file.out -t FLATFILE - The Reference Message is put (without any file data) to the queue specified by the /q parameter. If this is a remote queue, the message is put to the corresponding transmission queue.
- The sample waits, for the duration of time specified in the /w parameter (which defaults to 15 seconds), for COA reports, which, along with exception reports, are sent back to the dynamic queue created on the local queue manager (QMGR1).