Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should retry when the error occurs.kafka.(*Client).Produce: fetch request error: topic partition has no leader #1288

Open
stonever opened this issue May 9, 2024 · 0 comments
Labels

Comments

@stonever
Copy link

stonever commented May 9, 2024

Describe the bug

Kafka is encountering this error for some reason, but the client should support retries. I have configured the number of retries, but it is not working.

My code:

w := &kafka.Writer{
		Addr:                   kafka.TCP(option.Broker...),
		Topic:                  topic,
		Balancer:               &kafka.Hash{},
		Async:                  true,
		RequiredAcks:           kafka.RequireAll,
		Transport:              transport,
		MaxAttempts:            100,
		AllowAutoTopicCreation: true,
		Logger: kafka.LoggerFunc(func(s string, i ...interface{}) {
			log.With(ctx).Info().Msgf(s, i...)
		}),
		ErrorLogger: kafka.LoggerFunc(func(s string, i ...interface{}) {
			log.With(ctx).Error().Msgf(s, i...)
		}),
	}
@stonever stonever added the bug label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant