PG Transport + PG Persistence + Transactional Session

Hi! Just looking for a bit of advice/clarity.

If I’m using PostgreSQL transport, I’ll obviously be using PostgreSQL persistence. I would also like to use, transactional session where I’m not in a message handler.

Following this guide -Combining PostgreSQL Persistence and Transport • Sql Persistence • Particular Docs - and then combining it with this example - Using TransactionalSession with Entity Framework and ASP.NET Core • NServiceBus.Persistence.Sql.TransactionalSession Samples • Particular Docs - I’m getting myself a little confused as to what my setup should look like.

For a webapi (which would be send-only if it wasn’t for this Ability to use the transactional session inside a send-only endpoint · Issue #96 · Particular/NServiceBus.TransactionalSession · GitHub) I really just need transactional session. But given everything is Postgres, do I need Outbox enabled in that scenario to guarantee exactly-once delivery, if I’m using the synchronized storage session from the service collection (see web api example)?

Then for a non-web endpoint (handling messages in message handlers or sagas), again, do I need outbox enabled to ensure exactly-once delivery? And do I need outbox enabled to be able to enlist the transaction in a message handler, as per the web api example?

Feel like I’m probably just getting a little overwhelmed by the information being in a few different places, rather than in a single example that fits my use case… that’s on me. But hoping we might be able to have a conversation here about it.

Thanks!

Ok I think this one is solved, largely by Postgres SQL Persistence - should events be publishable to two consumers which use the same DB?

I’ll lay out what the setup is, in case it helps anybody in the future.

Web API

  • Outbox enabled
  • PostgreSql Transport with TransportTransactionMode.ReceiveOnly
  • (Postgre)Sql persistence with Transactional Session enabled

Saga Service / Domain Service

  • Outbox enabled
  • PostgreSql Transport with TransportTransactionMode.ReceiveOnly
  • (Postgre)Sql persistence (no Transactional Session enabled as not required)