Process Flow - Transaction mode vs confirms
Start Publishing
Choose Mode
Transaction
Begin Tx
Publish Msg
Commit Tx?
Confirm Msg
End Tx
Done
This flow shows how message publishing differs between transaction mode and confirm mode in RabbitMQ.
channel.txSelect() channel.basicPublish(exchange, routingKey, message) channel.txCommit()
| Step | Action | Mode | Result | Notes |
|---|---|---|---|---|
| 1 | Start publishing | Transaction | Channel ready for transaction | txSelect() called |
| 2 | Publish message | Transaction | Message buffered, not sent yet | basicPublish() buffers message |
| 3 | Commit transaction | Transaction | Message sent and confirmed | txCommit() sends all buffered messages |
| 4 | Start publishing | Confirm | Channel in confirm mode | Confirm mode enabled |
| 5 | Publish message | Confirm | Message sent immediately | basicPublish() sends message |
| 6 | Wait for ack | Confirm | Broker confirms message received | Wait for ack from broker |
| 7 | Confirm received | Confirm | Message confirmed | Ack received, safe to proceed |
| 8 | End | Both | Publishing complete | Process ends |
| 9 | Exit | Both | No more messages | Publishing done |
| Variable | Start | After Step 2 | After Step 3 | After Step 5 | After Step 6 | Final |
|---|---|---|---|---|---|---|
| Message State | Not sent | Buffered | Sent and confirmed | Sent | Confirmed | Confirmed |
| Channel Mode | Normal | Transaction | Normal | Confirm | Confirm | Confirm |
Transaction mode: - Use txSelect() to start - Messages buffered until txCommit() - Commit sends all messages atomically Confirm mode: - Enable confirm mode on channel - Messages sent immediately - Broker sends ack for each message Transaction mode is slower but atomic. Confirm mode is faster and asynchronous.