Handler ordering by interface

Project Hosting | Nuget: NServiceBus.HandlerOrdering (Version: 1.x) | License
This is a community run project. License and support are independent of Particular Software.
Target NServiceBus Version: 6.x

NServiceBus.HandlerOrdering

This extension allows a more expressive way to Order Handlers.

HandlerOrdering allows the dependency between handlers to be expressed via interfaces and the resulting order is derived at runtime.

Configuring to use HandlerOrdering

Edit
endpointConfiguration.ApplyInterfaceHandlerOrdering();

Expressing dependencies

MessageHandler1 wants to run after MessageHandler3

Edit
public class MessageHandler1 :
    IHandleMessages<MyMessage>,
    IWantToRunAfter<MessageHandler3>
{

MessageHandler2 wants to run after MessageHandler1

Edit
public class MessageHandler2 :
    IHandleMessages<MyMessage>,
    IWantToRunAfter<MessageHandler1>
{

Resulting execution order

  1. MessageHandler3
  2. MessageHandler1
  3. MessageHandler2

Last modified