Handlers and Sagas

Component: NServiceBus

There are two standards ways of executing code when a message is processed: Handlers and Sagas.

Handler instances are instantiated on a per message basis, executed and then disposed of.

Saga instances are also instantiated on a per message basis, executed and then disposed of. However they differ from Handlers in that they once instantiated they are passed an instance of a "Data" class. The "Saga Data" is persistent state that is shared between a given saga type based on a key.

Other concepts that both Handlers and Sagas share

Samples

Related Articles

  • Handlers
    Write a class to handle messages in NServiceBus.
  • Sagas
    NServiceBus uses event-driven architecture to include fault-tolerance and scalability in long-term business processes.

Last modified