public QuoteValueCriterionSubscriptionCommand(QuoteValueCriterionSubscriptionRequest request,
                                               ISubscriptionsManager subscriptionsManager, IExchangeRatesProvider exchangeRatesProvider)
 {
     _request = request ?? throw new ArgumentException($"{nameof(QuoteValueCriterionSubscriptionRequest)} {MessageTexts.NotSpecified}");
     _subscriptionsManager  = subscriptionsManager ?? throw new ArgumentException($"{nameof(ISubscriptionsManager)} {MessageTexts.NotSpecified}");
     _exchangeRatesProvider = exchangeRatesProvider ?? throw new ArgumentException($"{nameof(IExchangeRatesProvider)} {MessageTexts.NotSpecified}");
 }
        public SBService(ISubscriptionsManager subscriptionsManager, ISendingManager sendingManager, IReceivingManager receivingManager, IStatisticsService statisticsService, IObjectRepository objectRepository)
        {
            if (subscriptionsManager == null)
            {
                throw new ArgumentNullException(nameof(subscriptionsManager));
            }

            if (sendingManager == null)
            {
                throw new ArgumentNullException(nameof(sendingManager));
            }

            if (receivingManager == null)
            {
                throw new ArgumentNullException(nameof(receivingManager));
            }

            if (statisticsService == null)
            {
                throw new ArgumentNullException(nameof(statisticsService));
            }

            if (statisticsService == null)
            {
                throw new ArgumentNullException(nameof(objectRepository));
            }

            _subscriptionsManager = subscriptionsManager;
            _sendingManager       = sendingManager;
            _receivingManager     = receivingManager;
            _statisticsService    = statisticsService;
            _objectRepository     = objectRepository;
        }
        public BaseSendingManager(ISubscriptionsManager subscriptionsManager, IStatisticsService statistics, IDataService dataService, ILogger logger)
        {
            if (subscriptionsManager == null)
            {
                throw new ArgumentNullException(nameof(subscriptionsManager));
            }

            if (statistics == null)
            {
                throw new ArgumentNullException(nameof(statistics));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (dataService == null)
            {
                throw new ArgumentNullException(nameof(dataService));
            }

            _subscriptionsManager = subscriptionsManager;
            _statistics           = statistics;
            _dataService          = dataService;
            _logger = logger;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CrossBusCommunicationService"/> class with specified settings.
        /// </summary>
        /// <param name="subscriptionsManager">The subscriptions manager.</param>
        /// <param name="repository">The objects repository.</param>
        /// <param name="logger">The logger.</param>
        public CrossBusCommunicationService(
            ISubscriptionsManager subscriptionsManager,
            IObjectRepository repository,
            ILogger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }

            if (subscriptionsManager == null)
            {
                throw new ArgumentNullException(nameof(subscriptionsManager));
            }

            _repository           = repository;
            _logger               = logger;
            _subscriptionsManager = subscriptionsManager;

            _scanThread = new Thread(Scan)
            {
                Name = $"{nameof(CrossBusCommunicationService)}.{nameof(Scan)}"
            };
        }
        public BaseSendingManager(ISubscriptionsManager subscriptionsManager, IStatisticsService statistics, IDataService dataService, ILogger logger, bool useLegacySenders)
        {
            if (subscriptionsManager == null)
            {
                throw new ArgumentNullException(nameof(subscriptionsManager));
            }

            if (statistics == null)
            {
                throw new ArgumentNullException(nameof(statistics));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (dataService == null)
            {
                throw new ArgumentNullException(nameof(dataService));
            }

            _subscriptionsManager = subscriptionsManager;
            _statistics           = statistics;
            _dataService          = dataService;
            _logger = logger;
            MessageSenderCreator = new MessageSenderCreator(_logger, useLegacySenders);
        }
        public OptimizedSendingManager(ISubscriptionsManager subscriptionsManager, IStatisticsService statisticsService, IDataService dataService, ILogger logger, bool useLegacySenders = true)
            : base(subscriptionsManager, statisticsService, dataService, logger, useLegacySenders)
        {
            if (statisticsService == null)
            {
                throw new ArgumentNullException(nameof(statisticsService));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (subscriptionsManager == null)
            {
                throw new ArgumentNullException(nameof(subscriptionsManager));
            }

            if (dataService == null)
            {
                throw new ArgumentNullException(nameof(dataService));
            }

            _logger = logger;
            _subscriptionsManager = subscriptionsManager;
            _statisticsService    = statisticsService;
            _dataService          = dataService;
        }
예제 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WcfService"/> class.
        /// </summary>
        /// <param name="subscriptionsManager">The subscriptions manager.</param>
        /// <param name="sendingManager">The sending manager.</param>
        /// <param name="receivingManager">The receiving manager.</param>
        /// <param name="logger">The logger.</param>
        public WcfService(ISubscriptionsManager subscriptionsManager, ISendingManager sendingManager, IReceivingManager receivingManager, ILogger logger)
        {
            if (subscriptionsManager == null)
            {
                throw new ArgumentNullException(nameof(subscriptionsManager));
            }

            if (sendingManager == null)
            {
                throw new ArgumentNullException(nameof(sendingManager));
            }

            if (receivingManager == null)
            {
                throw new ArgumentNullException(nameof(receivingManager));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _subscriptionsManager = subscriptionsManager;
            _sendingManager       = sendingManager;
            _receivingManager     = receivingManager;
            _logger = logger;
        }
 private void SetAllEventHandlers(ISubscriptionsManager manager, int queueNumber)
 {
     manager.AddOrUpdateConsumer($"q{queueNumber}", NewE <EventA>(), new EventHandlerType(typeof(EventHandlerA)));
     manager.AddOrUpdateConsumer($"q{queueNumber}", NewE <EventA>(), new EventHandlerType(typeof(EventHandlerA1)));
     manager.AddOrUpdateConsumer($"q{queueNumber}", NewE <EventB>(), new EventHandlerType(typeof(EventHandlerB)));
     manager.AddOrUpdateConsumer($"q{queueNumber}", NewE <EventB>(), new EventHandlerType(typeof(EventHandlerB1)));
 }
        public DefaultSendingManager(ISubscriptionsManager subscriptionsManager, IStatisticsService statistics, IDataService dataService, ILogger logger)
            : base(subscriptionsManager, statistics, dataService, logger, true)
        {
            if (subscriptionsManager == null)
            {
                throw new ArgumentNullException(nameof(subscriptionsManager));
            }

            if (statistics == null)
            {
                throw new ArgumentNullException(nameof(statistics));
            }

            if (dataService == null)
            {
                throw new ArgumentNullException(nameof(dataService));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _logger = logger;
            _subscriptionsManager = subscriptionsManager;
            _statistics           = statistics;
            _dataService          = dataService;

            _scanningThread = new Thread(ScanMessages)
            {
                Name = "DefaultSendingManager.ScanMessages"
            };
        }
예제 #10
0
        /// <summary>
        /// Constructor for <see cref="DefaultStatisticsService"/>.
        /// </summary>
        /// <param name="statSettings">Component for getting statistics settings.</param>
        /// <param name="saveService">Component for saving statistics.</param>
        /// <param name="timeService">Component for getting current time.</param>
        /// <param name="subscriptions">Subscriptions manager.</param>
        /// <param name="logger">Component for logging.</param>
        public DefaultStatisticsService(IStatisticsSettings statSettings, IStatisticsSaveService saveService, IStatisticsTimeService timeService, ISubscriptionsManager subscriptions, ILogger logger)
        {
            if (statSettings == null)
            {
                throw new ArgumentNullException(nameof(statSettings));
            }

            if (saveService == null)
            {
                throw new ArgumentNullException(nameof(saveService));
            }

            if (timeService == null)
            {
                throw new ArgumentNullException(nameof(timeService));
            }

            if (subscriptions == null)
            {
                throw new ArgumentNullException(nameof(subscriptions));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _statSettings  = statSettings;
            _saveService   = saveService;
            _timeService   = timeService;
            _subscriptions = subscriptions;
            _logger        = logger;

            _periodicalTimer = new PeriodicalTimer();
        }
예제 #11
0
        public FeedPreviewsLoader(ISubscriptionsManager subscriptionsManager)
        {
            _subscriptionsManager = subscriptionsManager;

	        var handler = new HttpClientHandler
	        {
		        AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip
	        };
            var client = new HttpClient(handler);

            _feedsObservable = _subscriptionsManager.Subscriptions
                .Select(s => s.Uri)
                .Distinct()
				.SelectMany(async url =>
				{
					this.Log().Debug($"loading {url}");
					var response = await client.GetStringAsync(url);
					this.Log().Debug($"parsing {url}");
					return FeedXmlParser.Parse(response);
				})
#if !DEBUG
				.SkipOnException()
#endif
				.ObserveOnDispatcher()
                .Select(feed => new FeedViewModel(feed.Title.Text, new PodcastItemsLoader(feed)));
        }
예제 #12
0
        public App(IExchangeRatesProvider ratesProvider, ISubscriptionsManager ntSubscriber,
                   AppSettings appSettings, SensitiveSettings sensitiveConfiguration)
        {
            _ratesProvider        = ratesProvider;
            _subscriptionsManager = ntSubscriber;

            AppSettings = appSettings;
            if (AppSettings == null)
            {
                throw new ArgumentNullException(nameof(AppSettings));
            }

            SensitiveConfiguration = sensitiveConfiguration;
            if (AppSettings.NotificationSettings == null)
            {
                throw new ArgumentNullException(nameof(NotificationSettings));
            }

            Bot = SensitiveConfiguration.ProxyEnabled ?
                  new TelegramBotClient(SensitiveConfiguration.BotApiKey, new WebProxy(SensitiveConfiguration.Proxy))
                : new TelegramBotClient(SensitiveConfiguration.BotApiKey);
            ConfigureBot();

            SetupUsages();
        }
예제 #13
0
 public EventBus(IRabbitMQPersistentConnection persistentConnection, ILogger <EventBus> logger, ISubscriptionsManager subscriptionsManager, RabbitMqConfig config)
 {
     _persistentConnection = persistentConnection ?? throw new ArgumentNullException(nameof(persistentConnection));
     _subscriptionsManager = subscriptionsManager ?? throw new ArgumentNullException(nameof(subscriptionsManager));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _config = config;
 }
예제 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PrioritySendingManager"/> class.
 /// </summary>
 /// <param name="subscriptionsManager">ISubscriptionsManager component.</param>
 /// <param name="statisticsService">IStatisticsService component.</param>
 /// <param name="dataService">Current DataService.</param>
 /// <param name="logger">ILogger component.</param>
 /// <param name="useLegacySenders">If <c>true</c>, previous versions of the interfaces will be used to send messages.</param>
 public PrioritySendingManager(ISubscriptionsManager subscriptionsManager, IStatisticsService statisticsService, IDataService dataService, ILogger logger, bool useLegacySenders = true)
     : base(subscriptionsManager, statisticsService, dataService, logger, useLegacySenders)
 {
     _subscriptionsManager = subscriptionsManager ?? throw new ArgumentNullException(nameof(subscriptionsManager));
     _statisticsService    = statisticsService ?? throw new ArgumentNullException(nameof(statisticsService));
     _dataService          = dataService ?? throw new ArgumentNullException(nameof(dataService));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
예제 #15
0
 public RabbitMQOperation(IRabbitMQPersistentConnection persistentConnection, ISubscriptionsManager subManager, ILifetimeScope lifetimeScope, string queueName = null)
 {
     this.persistentConnection = persistentConnection;
     this.queueName            = queueName;
     //this.mediator = mediator;
     this.subManager      = subManager;
     this.lifetimeScope   = lifetimeScope;
     this.consumerChannel = CreateConsumerChannel();
 }
 public ServiceBusMessageDispatcher(
     IServiceProvider services
     , ILogger <ServiceBusMessageDispatcher> logger
     , ISubscriptionsManager subscriptions)
 {
     _subscriptions = subscriptions ?? throw new ArgumentNullException(nameof(subscriptions));
     _services      = services ?? throw new ArgumentNullException(nameof(services));
     _logger        = logger ?? throw new ArgumentNullException(nameof(logger));
 }
예제 #17
0
 public EventBus(IRabbitMQPersistentConnection persistentConnection, ILogger <EventBus> logger,
                 ISubscriptionsManager subscriptionsManager, RabbitMqConfig config, IServiceProvider serviceProvider)
 {
     _persistentConnection = persistentConnection ?? throw new ArgumentNullException(nameof(persistentConnection));
     _subscriptionsManager = subscriptionsManager ?? throw new ArgumentNullException(nameof(subscriptionsManager));
     _subscriptionsManager.OnEventRemoved += SubsManager_OnEventRemoved;
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
     _config          = config;
     _serviceProvider = serviceProvider;
 }
예제 #18
0
        public EventBusRMQ(RMQSettings settings, IServiceProvider service, IRMQConnectionManager connectionManager, ISubscriptionsManager subscriptionManager)
        {
            this.settings            = settings;
            this.serviceCollection   = service;
            this.connectionmanager   = connectionManager;
            this.subscriptionManager = subscriptionManager;

            this.channel = CreateChannel();
            this.subscriptionManager.OnEventRemoved += SubsManager_OnEventRemoved;
        }
예제 #19
0
 public EventBusRabbitMQ(IRabbitMQPersisterConnection persistentConnection, ILogger logger, ILifetimeScope autofac, ISubscriptionsManager subsManager, string queueName = null, int retryCount = 5)
 {
     _persistentConnection = persistentConnection ?? throw new ArgumentNullException(nameof(persistentConnection));
     _logger      = logger ?? throw new ArgumentNullException(nameof(logger));
     _autofac     = autofac;
     _subsManager = subsManager ?? new InMemoryEventSubscriptionManager();
     _retryCount  = retryCount;
     _subsManager.OnEventRemoved += _subsManager_OnEventRemoved;
     _queueName       = queueName;
     _consumerChannel = CreateConsumerChannel();
 }
예제 #20
0
        /// <summary>
        /// Создаёт новый экземпляр класса <see cref="RmqSubscriptionsSynchronizer"/>.
        /// </summary>
        /// <param name="logger">Используемый компонент логирования.</param>
        /// <param name="esbSubscriptionsManager">Менеджер подписок шины.</param>
        /// <param name="mqSubscriptionsManager">Менеджер подписок </param>
        public RmqSubscriptionsSynchronizer(ILogger logger, ISubscriptionsManager esbSubscriptionsManager, ISubscriptionsManager mqSubscriptionsManager, IDataService dataService, IManagementClient managementClient, string vhost = "/")
        {
            this._logger = logger;
            this._esbSubscriptionsManager = esbSubscriptionsManager;
            this._mqSubscriptionsManager  = mqSubscriptionsManager;
            this._dataService             = dataService;
            this._managementClient        = managementClient;

            this._namingManager = new AmqpNamingManager();
            this._vhostStr      = vhost;
        }
예제 #21
0
 public EventBusRabbitMQ(ILogger <EventBusRabbitMQ> logger,
                         ISubscriptionsManager subscriptionManager,
                         IFactory <EventType, EventHandlerType, object> handlersFac,
                         IFactory <IConnectionStrategy> connectionManager,
                         TinyEventBusConfiguration configuration)
 {
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _subscriptionManager = subscriptionManager ?? throw new ArgumentNullException(nameof(subscriptionManager));
     _handlersFac         = handlersFac;
     _connectionManager   = connectionManager;
     _configuration       = configuration;
 }
 public TimedHostedNotificationService(
     NotificationSettings notificationSettings,
     IExchangeRatesProvider exchangeRatesProvider,
     IAssetValueChangedEventHandler assetValueChangedEventHandler,
     ISubscriptionsManager subscriptionsManager)
     : base(notificationSettings.IntervalMilliseconds,
            notificationSettings.DueTimeSpanSeconds)
 {
     _exchangeRatesProvider  = exchangeRatesProvider;
     _subscriptionsManager   = subscriptionsManager;
     AssetValueChangedEvent += async(sender, args) => await assetValueChangedEventHandler.Handle(sender, args);
 }
        public RmqSendingManager(ILogger logger, ISubscriptionsManager esbSubscriptionsManager, IConnectionFactory connectionFactory, IManagementClient managementClient, IMessageConverter converter, AmqpNamingManager namingManager, string vhost = "/", bool useLegacySenders = true)
        {
            this._logger = logger;
            this._esbSubscriptionsManager = esbSubscriptionsManager;
            this._connectionFactory       = connectionFactory;
            this._managementClient        = managementClient;
            this._converter           = converter;
            this._namingManager       = namingManager;
            this.MessageSenderCreator = new MessageSenderCreator(_logger, useLegacySenders);
            this._vhostName           = vhost;
            this.useLegacySenders     = useLegacySenders;

            this._consumers = new List <RmqConsumer>();
        }
예제 #24
0
        public FeedPreviewsLoader(ISubscriptionsManager subscriptionsManager)
        {
            _subscriptionsManager = subscriptionsManager;

            var client = new HttpClient();

            _feedsObservable = _subscriptionsManager.Subscriptions
                .Select(s => s.Uri)
                .Distinct()
                .SelectManyAndSkipOnException(uri => client.GetStringAsync(uri).ToObservable())
                .SelectAndSkipOnException(FeedXmlParser.Parse)
                .ObserveOnDispatcher()
                .Select(feed => new FeedViewModel(feed.Title.Text, new PodcastItemsLoader(feed)));
        }
예제 #25
0
        public RabbitMQEventBus(IRabbitMQConnection persistentConnection,
                                IServiceProvider serviceProvider, ILoggerFactory loggerFactory,
                                ISubscriptionsManager subsManager, EventReceivedFunc eventReceiver,
                                IEventSerializer <byte[]> eventSerializer, IEventNameTypeResolver eventNameTypeResolver)
        {
            _persistentConnection = persistentConnection ?? throw new ArgumentNullException(nameof(persistentConnection));
            _logger = loggerFactory.CreateLogger <RabbitMQEventBus>();

            _serviceProvider       = serviceProvider;
            SubscriptionsManager   = subsManager;
            _eventReceiver         = eventReceiver;
            _eventSerializer       = eventSerializer;
            _eventNameTypeResolver = eventNameTypeResolver;
        }
예제 #26
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="subscriptionsManager"></param>
        /// <param name="eventStore"></param>
        /// <param name="serviceProvider"></param>
        public SimulationEventBus(
            ILogger <SimulationEventBus> logger,
            ISubscriptionsManager subscriptionsManager,
            IEventQueue eventStore,
            IServiceProvider serviceProvider)
        {
            this.logger = logger;
            this.subscriptionsManager = subscriptionsManager ?? new InMemorySubscriptionsManager();
            this.eventStore           = eventStore;
            this.serviceProvider      = serviceProvider;
            this.subscriptionsManager.OnEventRemoved += SubscriptionsManager_OnEventRemoved;

            DoConsume();
        }
예제 #27
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="options"></param>
        /// <param name="subscriptionsManager"></param>
        /// <param name="serviceProvider"></param>
        public RedisEventBus(
            ILogger <RedisEventBus> logger,
            IOptions <RedisSettings> options,
            ISubscriptionsManager subscriptionsManager,
            IServiceProvider serviceProvider)
        {
            this.logger               = logger;
            this.settings             = options.Value;
            this.subscriptionsManager = subscriptionsManager ?? new InMemorySubscriptionsManager();
            this.serviceProvider      = serviceProvider;
            this.redis = ConnectionMultiplexer.Connect(settings.ConnectionString);
            this.subscriptionsManager.OnEventRemoved += SubscriptionsManager_OnEventRemoved;

            DoConsume();
        }
        public TopicSubscriber(ISubscriptionsManager subscriptions
                               , ILoggerProvider loggerProvider
                               , IServiceProvider serviceProvider
                               , IConfiguration config)
        {
            _logger          = loggerProvider.CreateLogger("AzureServiceBus");
            _subscriptions   = subscriptions;
            _serviceProvider = serviceProvider;

            var connection = new ServiceBusConnectionStringBuilder(config["EventBus:ConnectionString"]);

            _subscriptionClient = new SubscriptionClient(connection, config["EventBus:ClientName"]);

            RemoveDefaultRule();
            RegisterSubscriptionClientMessageHandler();
        }
예제 #29
0
        /// <summary>
        /// ctor,
        /// Start a polling thread for each event type configured
        /// At the moment the EventBus dosn't accept the adding of new topics at runtime and it doesn't need that.
        /// </summary>
        public EventBus(
            IConfiguration configuration,
            ISubscriptionsManager subscriptionsManager,
            IAmazonSimpleNotificationService simpleNotificationServiceClient,
            IIntegrationEventsRespository integrationEventsRespository,
            IAmazonSQS amazonSqsClient, ILogger <EventBus> logger)
        {
            _subscriptionsManager         = subscriptionsManager ?? throw new ArgumentNullException(nameof(subscriptionsManager));
            _snsClient                    = simpleNotificationServiceClient ?? throw new ArgumentNullException(nameof(simpleNotificationServiceClient));
            _amazonSqsClient              = amazonSqsClient ?? throw new ArgumentNullException(nameof(amazonSqsClient));
            _configuration                = configuration ?? throw new ArgumentNullException(nameof(configuration));
            _integrationEventsRespository = integrationEventsRespository ?? throw new ArgumentNullException(nameof(integrationEventsRespository));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            _pollingThreads = new List <Tuple <string, Thread, CancellationToken> >();
        }
예제 #30
0
 public RabbitMQEventBus(IConfiguration configuration, IRabbitMQPersistentConnection persistentConnection,
                         ILogger <RabbitMQEventBus> logger, ISubscriptionsManager subscriptionsManager, IOptions <RabbitMqOptions> options,
                         IServiceScopeFactory scopeFactory)
 {
     _persistentConnection = persistentConnection;
     _logger = logger;
     _subscriptionsManager = subscriptionsManager;
     _scopeFactory         = scopeFactory;
     _queueName            = options.Value.QueueName;
     _retryCount           = 5;
     if (configuration["EventBusRetryCount"] != null)
     {
         _retryCount = int.Parse(configuration["EventBusRetryCount"]);
     }
     _brokerName      = options.Value.BrokerName;
     _consumerChannel = CreateConsumerChannel();
 }
예제 #31
0
        public DefaultReceivingManager(
            ILogger logger,
            IObjectRepository objectRepository,
            ISubscriptionsManager subscriptionsManager,
            ISendingManager sendingManager,
            IDataService dataService,
            IStatisticsService statisticsService)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (objectRepository == null)
            {
                throw new ArgumentNullException(nameof(objectRepository));
            }

            if (subscriptionsManager == null)
            {
                throw new ArgumentNullException(nameof(subscriptionsManager));
            }

            if (sendingManager == null)
            {
                throw new ArgumentNullException(nameof(sendingManager));
            }

            if (dataService == null)
            {
                throw new ArgumentNullException(nameof(dataService));
            }

            if (statisticsService == null)
            {
                throw new ArgumentNullException(nameof(statisticsService));
            }

            _logger               = logger;
            _objectRepository     = objectRepository;
            _subscriptionsManager = subscriptionsManager;
            _sendingManager       = sendingManager;
            _dataService          = dataService;
            _statisticsService    = statisticsService;
        }
예제 #32
0
 public MqttEventBus(
     IMqttPersisterConnection mqttPersisterConnection,
     IEventProvider eventProvider,
     IConsumeMethodInvoker consumeMethodInvoker,
     IEventBusLogger <MqttEventBus> logger,
     IServiceScopeFactory scopeFactory,
     ISubscriptionsManager subsManager,
     BusOptions busOptions)
 {
     _mqttPersisterConnection = mqttPersisterConnection ?? throw new ArgumentNullException(nameof(mqttPersisterConnection));
     _mqttPersisterConnection.ClientConnectionChanged += OnConnectionLostAsync;
     _eventProvider        = eventProvider;
     _consumeMethodInvoker = consumeMethodInvoker;
     _logger       = logger ?? throw new ArgumentNullException(nameof(logger));
     _subsManager  = subsManager ?? throw new ArgumentNullException(nameof(ISubscriptionsManager));
     _retryCount   = busOptions?.RetryCount ?? 5;
     _scopeFactory = scopeFactory;
     _asyncLocker  = new SemaphoreSlim(busOptions.MaxConcurrentCalls, busOptions.MaxConcurrentCalls);
 }
		public AddSubscriptionViewModel(ISubscriptionsManager subscriptionsManager)
		{
			AddSubscriptionCommand = new AddCommand(subscriptionsManager);
		}