From 0149b0d2de631fb12890586008df7861dba6d804 Mon Sep 17 00:00:00 2001 From: Mehmet Sezer Date: Wed, 17 Apr 2024 14:17:23 +0300 Subject: [PATCH] feat: make unknown topic or partition error fatal (#87) * feat: make unknown topic or partition error fatal --- kafka/producer/producer_batch.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kafka/producer/producer_batch.go b/kafka/producer/producer_batch.go index cc55eeb..2944a78 100644 --- a/kafka/producer/producer_batch.go +++ b/kafka/producer/producer_batch.go @@ -151,7 +151,9 @@ func (b *Batch) FlushMessages() { func isFatalError(err error) bool { e, ok := err.(kafka.Error) - + if ok && errors.Is(err, kafka.UnknownTopicOrPartition) { + return true + } if (ok && e.Temporary()) || errors.Is(err, io.ErrUnexpectedEOF) || errors.Is(err, syscall.ECONNREFUSED) ||