Domain Events with .NET - Events Dispatcher Executor
Introduction You may remember my Domain Events with .NET post and library . I recently made some changes , and now, some more, of which I'll talk here. I'm now introducing a new concept: A dispatcher executor is a class that is responsible for calling subscribers when invoked by a dispatcher Events Dispatcher Executor Essentially, it's a new interface/abstraction, IEventsDispatcherExecutor . This interface - or, rather, one implementation of it - is the actual responsible for calling a subscription inside the IEventsDispatcher implementation, so all existing implementations were modified to use it. This allows, for example, a retry strategy. I included a simple one, which can be applied by using the WithRetries extension method: builder.Services.AddDomainEventsFromAssembly(typeof(Program).Assembly) .WithRetries(3, TimeSpan.FromSeconds(3)); And this is it. In the case of any exception while invoking the subscription, the executor will retry a number of times, with