PROPID_Q_TRANSACTION

 

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

(Optional.) The PROPID_Q_TRANSACTION property specifies whether the queue is a transactional queue or a nontransactional queue.

Property ID

PROPID_Q_TRANSACTION

Type Indicator

VT_UI1

MQPROPVARIANT Field

bVal

Property Value

This property can be set to one of the following values:

MQ_TRANSACTIONAL

All messages sent to the queue must come through a Message Queuing transaction.

MQ_TRANSACTIONAL_NONE

The default. No transaction operations can be performed on the queue.

Remarks

If a queue is transactional, it can accept only messages that are sent as part of a transaction (see MQSendMessage). However, messages can be retrieved from a local transactional queue with or without using a transaction (see MQReceiveMessage).

For information on how Message Queuing performs transactions, see Transactions.

To create a transactional queue, specify PROPID_Q_TRANSACTION in the MQQUEUEPROPS structure and call MQCreateQueue.

PROPID_Q_TRANSACTION cannot be changed once the queue is created. If an attempt is made to set it afterward, an MQ_ERROR_PROPERTY error is returned to the call, and the associated aStatus entry of the property will contain MQ_PROPERTY_NOTALLOWED.

To find out if the queue is a transactional queue, specify PROPID_Q_TRANSACTION in the MQQUEUEPROPS structure and call MQGetQueueProperties and examine its returned value.

When retrieving this property, the type indicator can be set to VT_UI1 or VT_NULL. If you set the type indicator equal to VT_NULL, Message Queuing automatically changes the type indicator to VT_UI1 during the function call.

Equivalent COM Property

When using COM components, the transaction level of the queue can be retrieved using the MSMQQueueInfo.IsTransactional2 property.

Example Code

The following code fragments show how PROPID_Q_TRANSACTION is specified in arrays that can be used to initialize an MQQUEUEPROPS structure for setting and retrieving this property.

To Set PROPID_Q_TRANSACTION

UCHAR ucTransactionLevel = MQ_TRANSACTIONAL;  
aQueuePropID[i] = PROPID_Q_TRANSACTION;        // Property identifier  
aQueuePropVar[i].vt = VT_UI1;                  // Type indicator  
aQueuePropVar[i].bVal = ucTransactionLevel;    // Creates a transactional queue  
i++;  

To Retrieve PROPID_Q_TRANSACTION

aQueuePropID[i] = PROPID_Q_TRANSACTION;       // Property identifier  
aQueuePropVar[i].vt = VT_NULL;                // Type indicator  
i++;  

The following examples are included in Using Message Queuing.

For an example of See
Creating a transactional queue C/C++ Code Example: Creating a Transactional Queue
Retrieving the transaction level of the queue C/C++ Code Example: Retrieving PROPID_Q_TRANSACTION

See Also

Queue Properties
aStatus
MQCreateQueue
MQGetQueueProperties
MQReceiveMessage
MQQUEUEPROPS
MQSendMessage