public AzureServiceBusConsumer(string topicName, string subscriptionName, IAmAMessageProducer messageProducer, IManagementClientWrapper managementClientWrapper, IMessageReceiverProvider messageReceiverProvider, int batchSize = 10) { _subscriptionName = subscriptionName; _topicName = topicName; _messageProducer = messageProducer; _managementClientWrapper = managementClientWrapper; _batchSize = batchSize; _messageReceiver = messageReceiverProvider.Get(_topicName, subscriptionName, ReceiveMode.PeekLock); }
private void GetMessageReceiverProvider() { s_logger.LogInformation($"Getting message receiver provider for topic {_topicName} and subscription {_subscriptionName} with receive Mode {_receiveMode}..."); try { _messageReceiver = _messageReceiverProvider.Get(_topicName, _subscriptionName, _receiveMode); } catch (Exception e) { s_logger.LogError(e, $"Failed to get message receiver provider for topic {_topicName} and subscription {_subscriptionName}."); } }
public override void PostInitialize() { RegisterIfNot <IKafkaConsumerOption, KafkaConsumerOption>(); RegisterIfNot <IKafkaConsumerBuilder, KafkaConsumerBuilder>(); RegisterIfNot <IMessageReceiverWrapper, KafkaConsumerWrapper>(); _messageReceiverWrapper = IocManager.Resolve <IMessageReceiverWrapper>(); var config = IocManager.Resolve <IMessageReceiverModuleConfiguration>(); if (!config.AutoStart) { return; } _messageReceiverWrapper.Connect(); }