Unit of Work documentation is a little confusing

I have a question to this documentation Unit of Work • NServiceBus • Particular Docs

If a business transaction is spread across multiple handlers …

Is this only referring to the scenario where you have multiple handlers on the same message?

Later in the text, there is a link to Unit of Work Usage How to create a custom unit of work.

I have read the code, and this must be another level of Unit of Work, only working for a single message handler, right?

Hi Stig

When NServiceBus receives an incoming message, there can be multiple handlers associated with that incoming message. A physical incoming message can have multiple associated “interfaces” or “views” which can be mapped to handlers. NServiceBus picks up all handlers and executes them one by one for the given incoming message.

The unit of work settings you mentioned on the first page Unit of Work • NServiceBus • Particular Docs control the transactionality behavior surrounding multiple handlers for a single incoming message while the custom unit of work implementing IManageUnitsOfWork mentioned on the second page Unit of Work Usage • NServiceBus Samples • Particular Docs implements an “extensibility” mechanism to wrap your custom code around multiple handlers for an incoming message.

They are conceptionally the same. One is a predefined unit of work that can be tweaked via settings and one is the extensibility point for custom unit of work but all related to unit of work.

FYI We are deprecating IManageUnitsOfWork as part of NServiceBus v9 in favor of pipeline behaviors.

What would you like to achieve that has caused you go down the rabbit hole of unit of work :smiley: ?

Regards,
Daniel

Thanks, my achievement is just to understand the documentation, before using any feature.

Do you also have a answer to my later question?

(if not the same UOW, the documentation is confusing the reader, by not emphasizing the difference)

I edited my answer slightly to better clarify things.