public Task OnMessage(Message message) { try { if (_messageQueueWorker.Submit(message)) { _logger.LogDebug("Group [{0}]: Will commit at offset {1}", _consumerSettings.GetGroup(), message.TopicPartitionOffset); return(Commit(message.TopicPartitionOffset)); } } catch (Exception e) { _logger.LogError(e, "Group [{0}]: Error occured while consuming a message: {0}, of type {1}", _consumerSettings.GetGroup(), message.TopicPartitionOffset, _consumerSettings.MessageType); throw; } return(Task.CompletedTask); }
public KafkaConsumerProcessor(ConsumerSettings consumerSettings, TopicPartition topicPartition, IKafkaCommitController commitController, MessageBusBase messageBus, MessageQueueWorker <Message> messageQueueWorker) { Log.InfoFormat(CultureInfo.InvariantCulture, "Creating for Group: {0}, Topic: {1}, Partition: {2}, MessageType: {3}", consumerSettings.GetGroup(), consumerSettings.Topic, topicPartition, consumerSettings.MessageType); _messageBus = messageBus; _consumerSettings = consumerSettings; TopicPartition = topicPartition; _commitController = commitController; _messageQueueWorker = messageQueueWorker; }
public GroupTopicConsumer(EventHubMessageBus messageBus, ConsumerSettings consumerSettings) : this(messageBus, new TopicGroup(consumerSettings.Topic, consumerSettings.GetGroup()), () => new PartitionConsumerForConsumers(messageBus, consumerSettings)) { }
public async ValueTask OnMessage([NotNull] ConsumeResult message) { try { if (_messageQueueWorker.Submit(message)) { _logger.LogDebug("Group [{group}]: Will commit at offset {offset}", _consumerSettings.GetGroup(), message.TopicPartitionOffset); await Commit().ConfigureAwait(false); } } catch (Exception e) { _logger.LogError(e, "Group [{group}]: Error occured while consuming a message at offset: {offset}, of type {messageType}", _consumerSettings.GetGroup(), message.TopicPartitionOffset, _consumerSettings.MessageType); throw; } }
public KafkaConsumerProcessor(ConsumerSettings consumerSettings, TopicPartition topicPartition, IKafkaCommitController commitController, MessageBusBase messageBus, MessageQueueWorker <ConsumeResult> messageQueueWorker) { _messageBus = messageBus ?? throw new ArgumentNullException(nameof(messageBus)); _logger = _messageBus.LoggerFactory.CreateLogger <KafkaConsumerProcessor>(); _logger.LogInformation("Creating for Group: {0}, Topic: {1}, Partition: {2}, MessageType: {3}", consumerSettings.GetGroup(), consumerSettings.Topic, topicPartition, consumerSettings.MessageType); _consumerSettings = consumerSettings; TopicPartition = topicPartition; _commitController = commitController; _messageQueueWorker = messageQueueWorker; }