public void Subscribe(IGamePlayListener listener)
 {
     lock (_lockObject)
     {
         _listeners.Add(listener);
     }
 }
 public void Unsubscribe(IGamePlayListener listener)
 {
     lock (_lockObject)
     {
         _listeners.Remove(listener);
     }
 }
        public CQRSService(
            IGamePlayEngine gamePlayEngine,
            IGamePlayListener gamePlayListener,
            IReadCacheDataRepository readCacheDataRepository,
            IGameDataRepository gameDataRepository,
            ICqrsLogicHandler logicHandler,
            IEventPublisher eventPublisher,
            IComponentContext componentContext,
            ILogFactory logFactory
            ) : base(componentContext, logFactory)
        {
            _gamePlayEngine          = gamePlayEngine;
            _gamePlayListener        = gamePlayListener;
            _readCacheDataRepository = readCacheDataRepository;
            _gameDataRepository      = gameDataRepository;

            _logicHandler = logicHandler;

            _handlers.AddRange(
                componentContext.ResolveAll <IHttpRequestHandler>()
                );

            _log = logFactory.CreateForType(this);

            // Subscribe myself to any event
            eventPublisher.Attach(this);
        }
        public ConsoleService(
            IGamePlayEngine gamePlayEngine,
            IGamePlayListener gamePlayListener,
            IReadCacheDataRepository readCacheDataRepository,
            IGameDataRepository gameDataRepository,
            ICqrsLogicHandler logicHandler,
            IComponentContext componentContext,
            ILogFactory logFactory
            ) : base(componentContext, logFactory)
        {
            _gamePlayEngine          = gamePlayEngine;
            _gamePlayListener        = gamePlayListener;
            _readCacheDataRepository = readCacheDataRepository;
            _gameDataRepository      = gameDataRepository;

            _logicHandler = logicHandler;

            _log = logFactory.CreateForType(this);
        }