Handler ordering by interface

Component: Handler ordering by interface
NuGet Package NServiceBus.HandlerOrdering (1.x)
This is a community run project
Target NServiceBus Version: 6.x

Configuring to use HandlerOrdering

endpointConfiguration.ApplyInterfaceHandlerOrdering();

Expressing dependencies

MessageHandler1 wants to run after MessageHandler3

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

MessageHandler2 wants to run after MessageHandler1

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

Resulting execution order

  1. MessageHandler3
  2. MessageHandler1
  3. MessageHandler2

Last modified