To manage all of this, messaging systems internally use transactions to make sure a message gets added or doesn’t get added to the channel, and gets read or doesn’t get read from the channel. Messaging systems also have to employ transactions—preferably two-phase, distributed transactions—to copy a message from the sender’s computer to the receiver’s computer, such that at any given time, the message is “really” only on one computer or the other.

