Pregunta

I am using JOliver's EventStore and for now I am using a synchronous dispatcher so that when the command comes in, it is processed by my command handler then persisted in the event store and then my event handler update my read model. At this stage I am not using NServiceBus but I hope to introduce it later. My eventstore database and readmodel are on the same machine.

What I have noticed is that if an exception is raised in my event handler (and also since I am not using DTC) the event is committed in the eventstore and the dispatch flag is set to false. This is what I expected but when I restart my server, the flag is set to true but the event handler code is never called.

Any ideas why this is happening?

I assumed any non-dispatched events would get dispatched or there would be some retry mechanism in the event store code.

¿Fue útil?

Solución

If I am not very mistaken, the dispatch flag set to false should occur once the event is stored. Typically you would do an initialization of your event store like this when starting your application :

var storeEvents = Wireup.Init()
                  ...
                  .DispatchTo(new DelegateMessageDispatcher(dispatcher.dispatchCommit)
                  .Build();

The flag is set to false before this action occurs dispatcher.dispatchCommit and to true once this action is a success.

are you not confused with event handler in your aggregate ?

public void Apply(MystuffDone evt)
{
   //code...
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top