MessageQueueTransactionType MessageQueueTransactionType MessageQueueTransactionType MessageQueueTransactionType Enum


指定消息队列事务的类型。Specifies the type of a Message Queuing transaction.

public enum class MessageQueueTransactionType
public enum MessageQueueTransactionType
type MessageQueueTransactionType = 
Public Enum MessageQueueTransactionType


Automatic Automatic Automatic Automatic 1

用于 Microsoft Transaction Server (MTS) 或 COM+ 1.0 服务的事务类型。A transaction type used for Microsoft Transaction Server (MTS) or COM+ 1.0 Services. 如果已有 MTS 事务上下文,将在发送或接收消息时使用它。If there is already an MTS transaction context, it will be used when sending or receiving the message.

None None None None 0

操作不是事务性的。Operation will not be transactional.

Single Single Single Single 3

用于单个内部事务的事务类型。A transaction type used for single internal transactions.


当读取或写入一条消息使用的重载MessageQueue类的SendReceive方法 (包括ReceiveByIdReceiveByCorrelationId) 采用transactionType参数,可以指定你与的交互方式队列。When you read or write a message using an overload of the MessageQueue class's Send or Receive methods (including ReceiveById and ReceiveByCorrelationId) that takes a transactionType parameter, you can specify how you are interacting with the queue. Automatic 使你可发送和接收来自外部事务 (如交互时,请与数据库应用程序),同时Single用于单个内部消息队列的事务。Automatic enables you to send and receive from external transactions (such as when you are interacting with database applications), while Single is used for single internal Message Queuing transactions.

None 可以从外部事务的事务性队列接收消息或将事务消息发送到非事务性队列。None enables you to receive a message from a transactional queue outside of a transaction or send a transactional message to a non-transactional queue. 这很有用,例如,当路由在单个事务中发送多条消息。This is useful, for example, when routing several messages sent within a single transaction.

如果你想要发送或接收消息使用消息队列内部事务,但不是单个内部事务,创建的实例MessageQueueTransaction类,并将它传递到重载SendReceive采用方法transaction参数,而不是另一个采用transactionType参数。If you want to send or receive a message using an internal Message Queuing transaction but not a single internal transaction, create an instance of the MessageQueueTransaction class and pass it into an overload of the Send or Receive methods that takes a transaction parameter rather than one that takes a transactionType parameter.