共用方式為


MSMQQueueInfo.IsTransactional2

 

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

(Introduced in MSMQ 3.0.) The IsTransactional2 property of the MSMQQueueInfo object indicates whether the queue supports transactions.

IsTransactional2 is a Boolean property that supersedes the non-Boolean MSMQQueueInfo.IsTransactional property.

Data type: Boolean
Run-time access: Read-only
Property IsTransactional2 As Boolean  

Property Value

A Boolean set to one of the following values:

True (-1)

The queue is only used in transactions.

False (0)

The queue is not used in transactions.

Remarks

Sending and receiving applications can use IsTransactional2 to test whether a queue must be used within the context of a transaction. If a queue is transactional, sending applications must send messages as part of a transaction, and receiving applications must read messages as part of a transaction.

For information on transactions, see Transactions.

IsTransactional2 supersedes MSMQQueueInfo.IsTransactional and should be used whenever possible. IsTransactional2 returns Boolean values that are consistent with the Microsoft® Visual Basic® Boolean data type. Otherwise, both properties are functionally equivalent.

Message Queuing initially sets the IsTransactional2 property based on the setting of the IsTransactional argument in the call to the MSMQQueueInfo.Create method when the queue is created.

To retrieve the transaction level of an existing queue, your application must first obtain an MSMQQueueInfo object that represents the queue. This object can be returned by a query using the MSMQQuery.LookupQueue method or created by the sending or receiving application.

Before using an application-created MSMQQueueInfo object, the application must initialize it to reference the queue by setting its MSMQQueueInfo.PathName or MSMQQueueInfo.FormatName property. For public queues, setting the FormatName property with a cached public format name instead of the PathName property frees Message Queuing from the need to retrieve information stored in the directory service to generate this format name. Direct format names can be used only for local private queues.

To retrieve the stored transaction level of a queue, call the MSMQQueueInfo.Refresh method and inspect the IsTransactional2 property. For public queues, the transaction level is stored in the directory service. For private queues, this information is stored on the local computer. The property values of the MSMQQueueInfo object are not updated with the values stored by Message Queuing until the MSMQQueueInfo.Refresh method is called.

In C++ COM applications, you must use a smart pointer to the IMSMQQueueInfo3 interface to expose the IsTransactional2 property.

Equivalent API Function Property

With function calls, the equivalent property is PROPID_Q_TRANSACTION.

Example Code

The following example is included in Using Message Queuing.

For an example of See
Retrieving the transaction level of an existing queue Visual Basic Code Example: Retrieving MSMQQueueInfo.IsTransactional2

Requirements

Windows NT/2000/XP: Included in Windows XP and Windows Server 2003.

Windows 95/98/Me: Unsupported.

Header: Declared in Mqoai.h.

Library: Use Mqoa.lib.

See Also

MSMQQueueInfo
PROPID_Q_TRANSACTION