共用方式為


Sending Messages to a Transactional Queue

 

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

Messages can be sent to a local or remote transactional queue within a transaction.

When sending messages, the application must get a successful return code from MQSendMessage and from its Commit call before it can be assured that the message will be sent. Calling MQSendMessage does not actually send the message within the transaction. The actual sending is done at some time after MS DTC commits the transaction. When MS DTC returns a successful commit return value, the sending application is guaranteed that the message will be sent. If a transaction is aborted, all Message Queuing transaction operations are rolled back, and no messages are sent.

Note

There is no limit to the number of messages sent in a single transaction. However, an application cannot send a message to a queue and then try to retrieve it during the same transaction.

A successful Commit, however, does not guarantee that all the messages sent within the transaction will reach their queues. For example, if you send three messages within a transaction they will not reach their queues at the same time. The first two messages may reach their queues, and the third message may not because its time-to-live timer expires while the message is on the wire.

Message Queuing treats each sent message separately, even if several messages were sent in the same transaction. A message is put into a queue whenever it reaches the destination queue manager. Message Queuing does not wait for all the messages sent in the same transaction to reach the queue manager and then put them all in the queue at the same time.

More Information

For information on See
Sending messages Sending Messages to a Transactional Queue
Retrieving message Retrieving Messages from a Transactional Queue
How messages are placed in the queue Ordering of Messages in a Transactional Queue
Checking for messages lost from the receiving queue Checking for Transaction Boundaries when Receiving Messages
Aborting Aborting the Transaction