Share via


PROPID_M_ADMIN_QUEUE

 

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 PROPID_M_ADMIN_QUEUE property specifies the administration queue used for system-generated acknowledgment messages.

Property ID

PROPID_M_ADMIN_QUEUE

Type Indicator

VT_LPWSTR

MQPROPVARIANT Field

pwszVal

Property Value

Format name string of the administration queue.

Remarks

You must set this property when you request acknowledgment messages from Message Queuing. Message Queuing will not return acknowledgment messages if an administration queue is not specified.

To request acknowledgment messages when a message is sent, specify PROPID_M_ADMIN_QUEUE along with PROPID_M_ACKNOWLEDGE in the MQMSGPROPS structure and call MQSendMessage.

When setting the administration queue in an HTTP message, you must set the PROPID_M_ADMIN_QUEUE property to an HTTP direct format name.

To retrieve the format name of the administration queue from a message, specify PROPID_M_ADMIN_QUEUE and PROPID_M_ADMIN_QUEUE_LEN in the MQMSGPROPS structure (the length property is used to verify that the format name was sent). Then call MQReceiveMessage or MQReceiveMessageByLookupId and examine the returned values.

If MQReceiveMessage or MQReceiveMessageByLookupId fails, returning an MQ_ERROR_FORMATNAME_BUFFER_TOO_SMALL error, use the returned value of PROPID_M_ADMIN_QUEUE_LEN to reallocate the format name buffer, and call the applicable function again.

Before using the returned format name, always check the length property PROPID_M_ADMIN_QUEUE_LEN to see if the administration queue format name was sent with the message. If the returned value of PROPID_M_ADMIN_QUEUE_LEN is 0 (zero), no format name was sent with the message. If the returned value is non-zero, PROPID_M_ADMIN_QUEUE contains the format name of the administration queue.

Equivalent COM Property

With COM components, the equivalent property for setting and retrieving the administration queue is MSMQMessage.AdminQueueInfo.

For information on See
How administration queues are used Administration Queues
What is in an acknowledgment message Acknowledgment Messages
HTTP direct format names Direct Format Names

Example Code

The following code fragments show how PROPID_M_ADMIN_QUEUE is specified in arrays that can be used to initialize an MQMSGPROPS structure for setting and retrieving the administration queue format name.

To Set the Administration Queue Format Name

aMsgPropId[i] = PROPID_M_ADMIN_QUEUE;               // Property ID  
aMsgPropVar[i].vt = VT_LPWSTR;                      // Type indicator  
aMsgPropVar[i].pwszVal = wszAdminFormatName;  
i++;  
aMsgPropId[i] = PROPID_M_ACKNOWLEDGE;               // Property ID  
aMsgPropVar[i].vt = VT_UI1;                         // Type indicator  
aMsgPropVar[i].bVal = MQMSG_ACKNOWLEDGMENT_FULL_RECEIVE;  
i++;  

To Retrieve the Administration Queue Format Name

ULONG ulBufferLength = 256;  
WCHAR * wszAdminFormatNameBuffer = NULL;  
wszAdminFormatNameBuffer = (WCHAR*)malloc(ulBufferLength*sizeof(WCHAR));  
if (wszAdminFormatNameBuffer == NULL)  
{  
  return MQ_ERROR_INSUFFICIENT_RESOURCES;  
}  
memset(wszAdminFormatNameBuffer, 0, ulBufferLength*sizeof(WCHAR));  
aMsgPropId[i] = PROPID_M_ADMIN_QUEUE;               // Property ID  
aMsgPropVar[i].vt = VT_LPWSTR;                      // Type indicator  
aMsgPropVar[i].pwszVal = wszAdminFormatNameBuffer;  
i++;  
  
aMsgPropId[i] = PROPID_M_ADMIN_QUEUE_LEN;           // Property ID  
aMsgPropVar[i].vt = VT_UI4;                         // Type indicator  
aMsgPropVar[i].ulVal = ulBufferLength;  
i++;  
  
// Reallocate memory for the administration queue format name buffer if necessary.  
wszAdminFormatNameBuffer = (WCHAR*)realloc(wszAdminFormatNameBuffer, aMsgPropVar[1].ulVal*sizeof(WCHAR));  
if (wszAdminFormatNameBuffer == NULL)  
{  
  return MQ_ERROR_INSUFFICIENT_RESOURCES;  
}  
memset(wszAdminFormatNameBuffer, 0, aMsgPropVar[1].ulVal*sizeof(WCHAR));  
aMsgPropVar[0].pwszVal = wszAdminFormatNameBuffer;  // Pointer to the new buffer  

The following examples are included in Using Message Queuing.

For an example of See
Specifying the administration queue when sending a message C/C++ Code Example: Requesting Acknowledgment Messages
Testing to see if acknowledgment messages were requested C/C++ Code Example: Verifying Acknowledgment Requests

See Also

Message Properties
MQMSGPROPS
MQReceiveMessage
MQReceiveMessageByLookupId
MQSendMessage
PROPID_M_ACKNOWLEDGE
PROPID_M_ADMIN_QUEUE_LEN