The MQSendMessageExt function sends a message using the specified producer and allows you to specify selected message header properties.
MQSendMessageExt (const MQProducerHandle producerHandle, const MQMessageHandle messageHandle MQDeliveryMode msgDeliveryMode, MQInt8 msgPriority, MQInt64 msgTimeToLive); |
MQStatus. See the MQStatusIsError() function for more information.
The handle to the producer sending this message. This handle is passed back to you by the MQCreateMessageProducerForDestination() function.
A handle to the message you want to send.
An enum
MQ_PERSISTENT_DELIVERY |
MQ_NONPERSISTENT_DELIVERY |
A integer value of 0 through 9; 0 being the lowest priority and 9 the highest.
An integer value specifying in milliseconds how long the message will live before it expires. When a message is sent, its expiration time is calculated as the sum of its time-to-live value and current GMT. A value of 0 indicates that he message will never expire.
The MQSendMessageExt function sends the specified message on behalf of the specified producer to the destination associated with the message producer. Use this function if you want to change the default values for the message header properties as shown in the next table.
Default value
MQ_PERSISTENT_DELIVERY
4
0, meaning no expiration limit
If you set these message headers using the MQSetMessageHeaders function before the send, they will be ignored when the message is sent. When the send completes, these message headers hold the values that are set by the send.
You cannot use this function with a producer that is created without a specified destination.
You can set the broker property MQ_ACK_ON_PRODUCE_PROPERTY to make sure that the message has reached its destination on the broker:
By default, the broker acknowledges receiving persistent messages only.
If you set the property to MQ_TRUE, the broker acknowledges receipt of all messages (persistent and non-persistent) from the producing client.
If you set the property to MQ_FALSE, the broker does not acknowledge receipt of any message (persistent or non-persistent) from the producing client.
Note that “acknowledgement” in this case is not programmatic but internally implemented. That is, the client thread is blocked and does not return until the broker acknowledges messages it receives from the producing client.
MQ_PRODUCER_NO_DESTINATION MQ_INVALID_PRIORITY MQ_INVALID_DELIVERY_MODE MQ_PRODUCER_CLOSED MQ_SESSION_CLOSED MQ_BROKER_CONNECTION_CLOSED MQ_THREAD_OUTSIDE_XA_TRANSACTION MQ_XA_SESSION_NO_TRANSATION