Skip to content

Handling connection errors with KafkaTemplate when cluster not available #2250

Answered by garyrussell
Walnussbaer asked this question in Q&A
Discussion options

You must be logged in to vote

As I said, there are no hooks; I was suggesting that if you get a timeout, use the admin client to see if it was a connectivity problem.

How shall I stop the producer from sending records?

I meant stop calling kafkaTemplate.send().

Is there another way to close the prodcuer that is wrapped by the KafkaTemplate?

You can call reset() on the producer factory to close the producer(s).

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
1 reply
@Walnussbaer
Comment options

Comment options

You must be logged in to vote
7 replies
@Walnussbaer
Comment options

@garyrussell
Comment options

@garyrussell
Comment options

@garyrussell
Comment options

@Walnussbaer
Comment options

Answer selected by Walnussbaer
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants