public EventLiveStreamerTest() { _loggerFactory = new LoggerFactory(); _loggerFactory.AddConsole(); var diagnosticSource = new MyDiagnosticSource(); _eventChannelRepository = new EventChannelRepository("ECommerce.Data.FileStore", new ConnectionOptions { Provider = "FileDb", ConnectionString = new FileInfo($"data\\data_{Guid.NewGuid()}.json").FullName }, _loggerFactory, new MyDiagnosticSource()); _eventSubscriptionRepository = new EventSubscriptionRepository(_eventChannelRepository, "ECommerce.Data.FileStore", new ConnectionOptions { Provider = "FileDb", ConnectionString = new FileInfo($"data\\data_{Guid.NewGuid()}.json").FullName }, _loggerFactory, new MyDiagnosticSource()); _eventMessageRepository = new EventRepository(_eventChannelRepository, "ECommerce.Data.FileStore", new ConnectionOptions { Provider = "FileDb", ConnectionString = new FileInfo($"data\\data_{Guid.NewGuid()}.json").FullName }, _loggerFactory, new MyDiagnosticSource()); _eventLiveStreamer = new EventLiveStreamerService(_eventChannelRepository, _eventSubscriptionRepository, _eventMessageRepository, _loggerFactory, diagnosticSource); }
public SubscriberClientService(IEventChannelRepository eventChannelRepository, IEventSubscriptionRepository eventSubscriptionRepository, IEventRepository eventRepository, IOptions <NotificationServiceSettings> settings, ILoggerFactory loggerFactory, DiagnosticSource diagnosticSource) { _logger = loggerFactory.CreateLogger <SubscriberClientService>(); _settings = settings.Value; _eventLiveStreamer = new EventLiveStreamerService(eventChannelRepository, eventSubscriptionRepository, eventRepository, loggerFactory, diagnosticSource); _channelName = $"{_settings.ApplicationName}.{_settings.ServiceName}"; var getChannelResult = _eventLiveStreamer.GetChannel(_channelName).Result; if (!getChannelResult.IsSuccessful || getChannelResult.Result == null) { _eventLiveStreamer.CreateChannel(_channelName, _settings.IsFifo, _settings.MaxLifeTimeSubscriber, _settings.MaxLifeTimeMessage).Wait(); } }