Putting messages on a queue
Use the MQPUT call to put messages on the queue. You can use MQPUT repeatedly to put many messages on the same queue, following the initial MQOPEN call. Call MQCLOSE when you have finished putting all your messages on the queue.
If you want to put a single message on a queue and close the queue immediately afterwards, you can use the MQPUT1 call. MQPUT1 performs the same functions as the following sequence of calls:
- MQOPEN
- MQPUT
- MQCLOSE
Generally however, if you have more than one message to put on the queue, it is more efficient to use the MQPUT call. This depends on the size of the message and the platform you are working on.
This chapter introduces putting messages to a queue, under these headings:
- Putting messages on a local queue using the MQPUT call
- Putting messages on a remote queue
- Controlling context information
- Putting one message on a queue using the MQPUT1 call
- Distribution lists
- Some cases where the put calls fail