From 80fffc098a94b81b20f1bb3713ac2f96e622b8e9 Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Sun, 4 Aug 2024 12:59:52 -0400 Subject: [PATCH] Refresh OAuth token in the background So that OAUTHBEARER authentication works even when poll isn't being called regularly (e.g., in a client just used for fetching metadata). --- src/client.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client.rs b/src/client.rs index 76115d324..5b40c84d9 100644 --- a/src/client.rs +++ b/src/client.rs @@ -268,6 +268,10 @@ impl Client { unsafe { rdsys::rd_kafka_set_log_level(client_ptr, config.log_level as i32) }; + if C::ENABLE_REFRESH_OAUTH_TOKEN { + unsafe { rdsys::rd_kafka_sasl_background_callbacks_enable(client_ptr) }; + } + Ok(Client { native: unsafe { NativeClient::from_ptr(client_ptr) }, context,