Export (0) Print
Expand All

MessageQueue.Transactional Property

Gets a value that indicates whether the queue accepts only transactions.

Namespace:  System.Messaging
Assembly:  System.Messaging (in System.Messaging.dll)

[MessagingDescriptionAttribute("MQ_Transactional")]
public bool Transactional { get; }

Property Value

Type: System.Boolean
true if the queue accepts only messages sent as part of a transaction; otherwise, false.

ExceptionCondition
MessageQueueException

An error occurred when accessing a Message Queuing method.

Transactional messaging refers to the coupling of several related messages into a single transaction. Sending messages as part of a transaction ensures that the messages are delivered in order, delivered only once, and successfully retrieved from their destination queue.

If a queue is transactional, it accepts only messages that are sent as part of a transaction. However, a non-transactional message can be sent or received from a local transaction queue without explicitly using transactional Begin, Commit, and Abort syntax. If a non-transactional message is sent to a transactional queue, this component creates a single-message transaction for it, except in the case of referencing a queue on a remote computer using a direct format name. In this situation, if you do not specify a transaction context when sending a message, one is not created for you and the message will be sent to the dead-letter queue.

If you send a non-transactional message to a transactional queue, you will not be able to roll back the message in the event of an exception.

[Visual Basic]

MessageQueueTransaction is threading apartment aware, so if your apartment state is STA, you cannot use the transaction in multiple threads. Visual Basic sets the state of the main thread to STA, so you must apply the MTAThreadAttribute in the Main subroutine. Otherwise, sending a transactional message using another thread throws a MessageQueueException exception. You apply the MTAThreadAttribute by using the following fragment.

<System.MTAThreadAttribute>
 public sub Main()

The following table shows whether this property is available in various Workgroup modes.

Workgroup mode

Available

Local computer

Yes

Local computer and direct format name

Yes

Remote computer

No

Remote computer and direct format name

No

The following code example displays the value of a message queue's Transactional property.

// Display the value of the queue's Transactional property.
Console.WriteLine("MessageQueue.Transactional: {0}",
    queue.Transactional);

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft