R
R
Rammstein0072021-02-16 20:56:12
Java
Rammstein007, 2021-02-16 20:56:12

How to interrupt the work of the Kafka client if the broker is not available?

In the case when the broker is not available, kafka tries to connect to it, how to make kafka throw the error immediately without reconnecting? Set the settings for the producer

producerProperties.put(ProducerConfig.RETRIES_CONFIG, 0);
producerProperties.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, 10000);

Log
20:00:30 [kafka-producer-network-thread | producer-5] WARN org.apache.kafka.clients.NetworkClient - [Producer clientId=producer-5] Connection to node -1 could not be established. Broker may not be available.
Failed to update metadata after 60000 ms.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question