If the broker connection is timing out then see if tuning 
SOCKET_CONNECTION_SETUP_TIMEOUT_MAX_MS_CONFIG / 
SOCKET_CONNECTION_SETUP_TIMEOUT_MS_CONFIG helps. The MAX defaults to 30 seconds.

From: dev@kafka.apache.org At: 02/13/23 08:46:12 UTC-5:00To:  
dev@kafka.apache.org
Subject: Timeout not getting applied on KafkaAdminClient.create

Hi,

I want to add timeout for KafkaAdminClient creation.

AdminClient admin1 = KafkaAdminClient.create(properties);

I have thread which gets killed after 10seconds. I want that if
KafkaAdminClient creation is taking more time it should timeout. But when
kafka-broker is not present my code gets stuck at above step
I have added AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG and
AdminClientConfig.DEFAULT_API_TIMEOUT_MS_CONFIG. but the value is not
getting picked.
Also it takes more than 30second which is the default timeout -
These are the log stackTrace when thread is
killed='[java.base@17.0.6/java.lang.Object.wait(Native
Method), java.base@17.0.6/java.lang.Thread.join(Thread.java:1298),
org.apache.kafka.clien
ts.admin.KafkaAdminClient.close(KafkaAdminClient.java:654),
org.apache.kafka.clients.admin.Admin.close(Admin.java:153)

Let me know if there are any params to configured here for timeout to
happen.

Thanks,
Shruti


Reply via email to