<< Click to Display Table of Contents >> TMessageQueue class |
Provides access to a queue on a Message Queuing server. MSMQ is a messaging protocol that allows applications running on separate servers/processes to communicate in a failsafe manner.
Transactional and Nontransactional Messaging (more info here)
Transactional Messaging
Transactional message is only used when you want to perform several tasks in an atomic way. In this context the term "atomic" means that you want to perform several operations, including non-Message Queuing operations, that will all succeed or all fail. When transactional messaging is used, the sending or receiving application has the opportunity to commit the transaction (all the operations have succeeded) or to abort the transaction (one of the operations failed). When a transaction is aborted all operations are rolled back to the state when the transaction was invoked.
When sending messages within a transaction, all the messages are sent together and in the order they were sent, or they are not sent at all. Message Queuing guarantees that all messages sent within the transaction will arrive exactly once, if they can be delivered, and in the order that they were sent. (Transactional messages cannot be sent to a multicast address.)
When retrieving messages within a transaction, all the messages are removed from the queue or they are placed back in the queue in their original position in the queue. Note that peeking at messages make no sense in the context of a transaction.
Nontransactional Messaging
When nontransactional messaging is used, Message Queuing sends each message as a single operation (this includes sending messages to multiple destinations).
This means that there is no guarantee that the messages will reach the destination queue in the order they were sent, not does it mean that the message will only arrive once.