MQMarkMessageRejected

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

The MQMarkMessageRejected function marks a message in a queue as rejected. It should be called only within the scope of a transaction.

HRESULT APIENTRY MQMarkMessageRejected (  
  QUEUEHANDLE hQueue,  
  ULONGLONG ullLookupId);  

Parameters

hQueue

[in] The handle of the queue that contains the message to be rejected.

ullLookupId

[in] The identity of the message that needs to be rejected.

Return Value

The MQMarkMessageRejected function returns an HRESULT.

MQ_OK

Indicates success.

MQ_ERROR_TRANSACTION_ENLIST

MSMQ is unable to enlist in the specified transaction.

MQ_ERROR_TRANSACTION_USAGE

The MQMarkMessageRejected function is invoked as a part of a transaction, but the source or the target queue is not a transactional queue; or the MQMarkMessageRejected function is not invoked within the scope of a transaction.

MQ_ERROR_DTC_CONNECT

MSMQ is unable to connect to the Microsoft Distributed Transaction Coordinator (MS DTC).

MQ_ERROR_STALE_HANDLE

Either the source or target queue handle was obtained in a previous session of the MSMQ Queue Manager service.

MQ_ERROR_INSUFFICIENT_RESOURCES

Insufficient resources to complete the operation.

MQ_ERROR_SERVICE_NOT_AVAILABLE

MSMQ service is not available/running.

MQ_ERROR_MESSAGE_NOT_FOUND

MSMQ message was not found.

Remarks

When a message marked as rejected is received, a negative acknowledgement (Nack) with the message class MQMSG_CLASS_NACK_RECEIVE_REJECTED is generated (if a Nack is requested) when the transaction is committed.

Note

The MQMarkMessageRejected function should be called only within the scope of a transaction; otherwise, the call will fail.

Requirements

Windows NT/2000/XP/Vista: Requires Windows Vista or later.

Windows 95/98/Me: Not supported.

Header: Declared in Mq.h.

Library: Use Mqrt.lib.

See Also

Subqueues