Ejemplo n.º 1
0
        public ChatClient(string streamPath, string userName)
        {
            _userName = userName;

            string key = "EventStore:BaseUrl";
            string baseUrl = System.Configuration.ConfigurationManager.AppSettings[key];
            if (string.IsNullOrEmpty(baseUrl))
            {
                throw new Exception("AppSetting '{0}' has not been set".FormatWith(key));
            }
            _eventStoreReader = new EventStoreReader(baseUrl, streamPath);
            _eventStoreWriter = new EventStoreWriter(baseUrl, streamPath);

            _messageRepository = new MessageRepository(_eventStoreReader);

            //_historyLogger = new LocalHistoryLogger(userName);
            //_historyReader = new LocalHistoryReader(userName);

            Feed = new ChatFeed(_messageRepository, _cancellationTokenSource.Token);

            _publisher = new ChatPublisher();
            //_publisher.Subscribe(_historyLogger);
            _publisher.Subscribe(_eventStoreWriter);

            Queue = new ChatQueue();
            Queue.Subscribe(_publisher);

            _publisher.Subscribe(Queue);   // CAUTION? - two way loop...
        }
Ejemplo n.º 2
0
 public MessageRepository(EventStoreReader eventStoreReader)
 {
     log.Trace("MessageRepository");
     _eventStoreReader = eventStoreReader;
 }