When using SQL persistence using the PostgreSQL dialect in combination with the PostgreSQL transport, the location of saga data depends both on whether the outbox is enabled and on the transaction mode.
Outbox disabled
PostgreSQL Transport TransactionMode | Connection sharing | Saga data location |
---|---|---|
SendsAtomicWithReceive | isolated transaction for send and receive | Transport DB |
ReceiveOnly | isolated transaction for receive | Transport DB |
None | No transactions | Persistence DB |
With the outbox disabled, the persistence uses the connection and transaction context established by the transport to access saga data. This behavior ensures exactly-once message processing, since the state change of a saga is committed atomically with the consumption of the message that caused it.
This behavior may be disabled, to force the persistance to create its own connection, as it does when the outbox is enabled:
In this mode NServiceBus does not guarantee exactly-once message processing behavior. A single incoming message could result in multiple calls of the saga message handling logic, if the previous processing attempt failed just before consuming the message.
Outbox enabled
PostgreSQL Transport TransactionMode | Connection sharing | Saga data location |
---|---|---|
SendsAtomicWithReceive | Not supported | N/A |
ReceiveOnly | via Transport storage context | Persistence DB |
None | Not supported | N/A |