public KafkaOffset(Confluent.Kafka.TopicPartitionOffset topicPartitionOffset) : this(topicPartitionOffset.Topic, topicPartitionOffset.Partition.Value, topicPartitionOffset.Offset.Value) { }
private async Task TryHandleMessage(Confluent.Kafka.Message <byte[], byte[]> message, Confluent.Kafka.TopicPartitionOffset tpo) { try { _messagesSinceCommit++; await HandleMessage( message.Value, message.Headers?.Select(h => h.ToSilverbackHeader()).ToList(), new KafkaOffset(tpo)); } catch (Exception ex) { _logger.LogCritical(ex, "Fatal error occurred consuming the message: {topic} {partition} @{offset}. " + "The consumer will be stopped.", tpo.Topic, tpo.Partition, tpo.Offset); Disconnect(); } }
public void Seek(Confluent.Kafka.TopicPartitionOffset tpo) => _innerConsumer.Seek(tpo);
private async Task OnMessageReceived(Confluent.Kafka.Message <byte[], byte[]> message, Confluent.Kafka.TopicPartitionOffset tpo) { // Checking if the message was sent to the subscribed topic is necessary // when reusing the same consumer for multiple topics. if (!Endpoint.Names.Any(endpointName => tpo.Topic.Equals(endpointName, StringComparison.InvariantCultureIgnoreCase))) { return; } await TryHandleMessage(message, tpo); }