private SubscribeHandler CreateSubscribeHandler(PublishSubscribeConfig config, string name, bool durable) { ValidatePublishSubscribeConfig(config); if (name.NullOrWhiteSpace()) { throw new ArgumentException("Invalid subscriber name", nameof(name)); } var subscribeHandler = new SubscribeHandler(_logger, _messageBroker, _queueHandlerFactory, name, config.Topic, durable, _queueNameUtility); lock (_subscribeHandlers) { if (_subscribeHandlers.Any(h => h.Name == name && h.Topic == config.Topic)) { throw new DoubleSubscribeHandlerException(config, name); } _subscribeHandlers.Add(subscribeHandler); } return(subscribeHandler); }
private void StartSubscribeHandler(SubscribeHandler subscribeHandler) { subscribeHandler.Start(_cancellationTokenSource.Token, SyncMode); SendHandshake(); }