Uniform session with Transactional session

Hey all,

I’m looking at combining the UniformSession with TransactionalSession. Right now UniformSession combines IMessageSession with IMessageHandlerContext. But IMessageSession doesn’t participate in Outbox.

The situation is a library dependency A sends messages and this dependency can be used:

  • Inside a web API, send-only endpoint that now has TransactionalSession and Outbox enabled
  • Inside a handler that has Outbox enabled

This code is not directly inside the handler or the web API, but in a call graph say 7 levels deep. Modifying such a call graph to have overloads for ITransactionalSession or IMessageHandlerContext is…not ideal.

My thoughts at the moment are to create an IEvenMoreUniformSession that wraps ITransactionalSession and IUniformSession, since UniformSession at least gets SOMETHING to be inject-able.

Has anyone tried this?

There is a discussion about this type of feature here, Ability to use `ITransactionalSession` via dependancy injection in an incoming message context · Issue #65 · Particular/NServiceBus.TransactionalSession · GitHub, as far as I know no one have tried it out yet.

Gotcha! I left a comment on how I made it work with adapters. Not too bad, will probably blog about it. Or not.