Module: Rdkafka::Helpers::OAuth
Instance Method Summary collapse
-
#oauthbearer_set_token(token:, lifetime_ms:, principal_name:, extensions: nil) ⇒ Integer
Set the OAuthBearer token.
-
#oauthbearer_set_token_failure(reason) ⇒ Object
Marks failed oauth token acquire in librdkafka.
Instance Method Details
#oauthbearer_set_token(token:, lifetime_ms:, principal_name:, extensions: nil) ⇒ Integer
Set the OAuthBearer token
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rdkafka/helpers/oauth.rb', line 13 def oauthbearer_set_token(token:, lifetime_ms:, principal_name:, extensions: nil) error_buffer = FFI::MemoryPointer.from_string(" " * 256) response = @native_kafka.with_inner do |inner| Rdkafka::Bindings.rd_kafka_oauthbearer_set_token( inner, token, lifetime_ms, principal_name, flatten_extensions(extensions), extension_size(extensions), error_buffer, 256 ) end return response if response.zero? oauthbearer_set_token_failure("Failed to set token: #{error_buffer.read_string}") response end |
#oauthbearer_set_token_failure(reason) ⇒ Object
Marks failed oauth token acquire in librdkafka
33 34 35 36 37 38 39 40 |
# File 'lib/rdkafka/helpers/oauth.rb', line 33 def oauthbearer_set_token_failure(reason) @native_kafka.with_inner do |inner| Rdkafka::Bindings.rd_kafka_oauthbearer_set_token_failure( inner, reason ) end end |