Design of the Echo sample programs
The program opens the queue named in the trigger message structure that it was passed when it started. (For clarity, we will call this the request queue.) The program uses the MQOPEN call to open this queue for shared input.
The program uses the MQGET call to remove messages from this queue. This call uses the MQGMO_ACCEPT_TRUNCATED_MSG, MQGMO_CONVERT, and MQGMO_WAIT options, with a wait interval of 5 seconds. The program tests the descriptor of each message to see if it is a request message; if it is not, the program discards the message and displays a warning message.
For each line of input, the program then reads the text into a buffer and uses the MQPUT1 call to put a request message, containing the text of that line, onto the reply-to queue.
If the MQGET call fails, the program puts a report message on the reply-to queue, setting the Feedback field of the message descriptor to the reason code returned by the MQGET.
When there are no messages remaining on the request queue, the program closes that queue and disconnects from the queue manager.
On i5/OS, the program can also respond to messages sent to the queue from platforms other than WebSphere MQ for iSeries, although no sample is supplied for this situation. To make the ECHO program work:
- Write a program, correctly specifying the Format, Encoding, and CCSID parameters, to send text request messages.
The ECHO program requests the queue manager to perform message data conversion, if this is needed.
- Specify CONVERT(*YES) on the WebSphere MQ for iSeries sending channel, if the program that you have written does not provide similar conversion for the reply.
Parent topic:
The Echo sample programs
fg17600_