Sun GlassFish Message Queue 4.4 Developer's Guide for C Clients

MQCreateMessageProducerForDestination

The MQCreateMessageProducerForDestination function creates a message producer with a specified destination.


MQCreateMessageProducerForDestination
                    (const MQSessionHandle sessionHandle,
                     const MQDestinationHandle destinationHandle,
                     MQProducerHandle * producerHandle);

Return Value

MQStatus. See the MQStatusIsError() function for more information.

Parameters

sessionHandle

The handle to the session to which this producer belongs.

destinationHandle

A handle to the destination where you want this producer to send all messages. This handle remains valid after the call returns.

producerHandle

Output parameter for the handle that references the producer.

The MQCreateMessageProducerForDestination function creates a message producer with a specified destination. All messages sent out by this producer will go to that destination. Use the MQSendMessage() function or the MQSendMessageExt() function to send messages for a producer with a specified destination.

Use the MQCreateMessageProducer() function when you want to use one producer to send messages to a variety of destinations.

A session’s producers are automatically closed when you close the session or connection to which they belong. To close a producer without closing the session or connection to which it belongs, use the MQCloseMessageProducer() function.

Common Errors

MQ_SESSION_CLOSED
MQ_BROKER_CONNECTION_CLOSED