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采用Receive Send ReceiveById参数的类或ReceiveByCorrelationId方法 (包括和) 的重载读取或写入消息时, 可以指定如何与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.