Exemplo n.º 1
0
 public void Handle(NewIncomingEvents message)
 {
     foreach (var @event in message.IncomingEvents)
     {
         if (this.handlers.ContainsKey(@event.GetType()))
         {
             try
             {
                 this.state = this.handlers[@event.GetType()].Invoke(this.state, @event);
                 this.bus.Publish(new IncomingEventHasBeenProcessed(@event));
             }
             catch (Exception ex)
             {
                 var wrappedEx = new FatalErrorException($"An error ocurred while handling event of type {@event.GetType()}", ex);
                 this.bus.Publish(new FatalErrorOcurred(wrappedEx));
                 this.log.Error(wrappedEx, "Query failed");
                 throw;
             }
         }
     }
 }
Exemplo n.º 2
0
 public FatalErrorOcurred(FatalErrorException exception)
 {
     this.Exception = exception;
 }
Exemplo n.º 3
0
 public void Handle(FatalErrorOcurred message)
 {
     this.fatalException      = message.Exception;
     this.systemHaltRequested = true;
     this.Stop();
 }
Exemplo n.º 4
0
 public FatalErrorOcurred(FatalErrorException exception)
 {
     this.Exception = exception;
 }