다음을 통해 공유


PROPID_MGMT_QUEUE_STATE

 

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

(Read-only, introduced in MSMQ 3.0.) The PROPID_MGMT_QUEUE_STATE property returns the connection state of the outgoing queue.

Property ID

PROPID_MGMT_QUEUE_STATE

Type Indicator

VT_LPWSTR

MQPROPVARIANT Field

pwszVal

Property Value

One of the following Unicode strings:

L"CONNECTED" (MGMT_QUEUE_STATE_CONNECTED)

The applicable outgoing queue is connected to the queue manager on the computer. This state indicates the local queue manager is sending messages and that the messages should be going out immediately.

L"DISCONNECTED" (MGMT_QUEUE_STATE_DISCONNECTED)

The applicable outgoing queue is not connected nor is it in the process of being connected. This state indicates that the queue manager on the computer is not sending messages to the destination queue or in the process of connecting the applicable outgoing queue.

L"DISCONNECTING" (MGMT_QUEUE_STATE_DISCONNECTING)

The queue manager is in the process of disconnecting the applicable outgoing queue, or the computer is in the process of disconnecting from the applicable session. The queue manager cannot send messages to the destination queue in this state.

L"INACTIVE" (MGMT_QUEUE_STATE_NONACTIVE)

The applicable outgoing queue is in a state in which the queue manager does not attempt to connect it to any session.

L"LOCAL CONNECTION" (MGMT_QUEUE_STATE_LOCAL)

The queue is a local queue on the computer. This state indicates that sending messages to the queue does not require a network connection.

L"LOCKED" (MGMT_QUEUE_STATE_LOCKED)

The applicable outgoing queue is in the state defined by hardened MSMQ mode for outgoing queues that correspond to destination queues specified by non-HTTP format names. Messages in locked outgoing queues are not transmitted to their destinations.

L"NEED VALIDATION" (MGMT_QUEUE_STATE_NEED_VALIDATE)

The queue was opened when the queue manager was offline.

L"ONHOLD" (MGMT_QUEUE_STATE_ONHOLD)

The applicable outgoing queue is paused.

L"WAITING" (MGMT_QUEUE_STATE_WAITING)

The queue manager is in the process of connecting the applicable outgoing queue.

Remarks

To retrieve the connection state of the queue, include PROPID_MGMT_QUEUE_STATE in the MQMGMTPROPS structure, and then call MQMgmtGetInfo.

This property can be retrieved only for an active queue. MQMgmtGetInfo will return a non-specific error (MQ_ERROR) if your application attempts to retrieve the connection state of a queue that does not contain messages and is not opened by an application.When specifying PROPID_MGMT_QUEUE_STATE in the MQMGMTPROPS structure, set its type indicator to VT_NULL. During the function call, Message Queuing automatically changes the type indicator to VT_LPWSTR and creates the string buffer needed to receive the property value. After you no longer need the string buffer, you must free the memory allocated for it using MQFreeMemory.

Equivalent COM Property

When using COM components, you can retrieve the connection state of a queue using the MSMQOutgoingQueueManagement.State property.

Example Code

The following code fragment shows how PROPID_MGMT_QUEUE_STATE is specified in arrays that can be used to initialize an MQMGMTPROPS structure.

aMgmtPropID[i] = PROPID_MGMT_QUEUE_STATE;     // Property identifier  
aMgmtPropVar[i].vt = VT_NULL;                 // Type indicator  
i++;  

The following line of code shows how to free the memory allocated for the property value.

MQFreeMemory(aMgmtPropVar[i].pwszVal);  

See Also

Management Properties
MQFreeMemory
MQMgmtGetInfo
MSMQOutgoingQueueManagement.State