public IEventResponse HandleGameEvent(IGameMessage @event)
        {
            if (_responses.ContainsKey(@event.GetType()))
            {
                return(_responses[@event.GetType()]);
            }

            return(new NullResponse(@event.ActionScope));
        }
Ejemplo n.º 2
0
 public void Fire(IGameMessage @event)
 {
     if (_messageMaps.ContainsKey(@event.GetType()))
     {
         _messageMaps[@event.GetType()].Fire(@event);
     }
     else
     {
         // This saga does not handle this particular message
     }
 }
Ejemplo n.º 3
0
 private void RouteToNewSagas(IGameMessage @event)
 {
     try
     {
         var typeForSagasStartedByEvent = typeof(IStartedBy <>).MakeGenericType(@event.GetType());
         var sagas = _container.GetAllInstances(typeForSagasStartedByEvent).Cast <Saga>().ToList();
         sagas.ForEach(saga => StartSaga(@event, saga));
     }
     catch (Exception)
     {
     }
 }
 public void Publish(IGameMessage @event)
 {
     _publishedEvents.Add(@event);
     Console.WriteLine("MockEventAggregator: event published: {0}, {1}, {2}", @event.Id, @event.GetType().Name, @event);
 }