Skip to content

Commit

Permalink
fix: use Kafka 'earliest' offset strategy to avoid missing messages
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Voiturier <[email protected]>
  • Loading branch information
bvoiturier committed Nov 19, 2024
1 parent 509c62b commit b8bf9f7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import zio.kafka.consumer.{
ConsumerSettings as ZKConsumerSettings,
Subscription as ZKSubscription
}
import zio.kafka.consumer.Consumer.{AutoOffsetStrategy, OffsetRetrieval}
import zio.kafka.producer.{Producer as ZKProducer, ProducerSettings as ZKProducerSettings}
import zio.kafka.serde.{Deserializer as ZKDeserializer, Serializer as ZKSerializer}

Expand Down Expand Up @@ -80,7 +81,7 @@ class ZKafkaConsumerImpl[K, V](
.withMaxPollInterval(maxPollInterval) // Should be max.poll.records x 'max processing time per record'
// 'pollTimeout' default is 50 millis. This is a ZIO Kafka property.
.withPollTimeout(pollTimeout)
// .withOffsetRetrieval(OffsetRetrieval.Auto(AutoOffsetStrategy.Earliest))
.withOffsetRetrieval(OffsetRetrieval.Auto(AutoOffsetStrategy.Earliest))
.withRebalanceSafeCommits(rebalanceSafeCommits)
// .withMaxRebalanceDuration(30.seconds)
)
Expand Down

0 comments on commit b8bf9f7

Please sign in to comment.