php-rdkafka icon indicating copy to clipboard operation
php-rdkafka copied to clipboard

Call to undefined method RdKafka\KafkaConsumer::oauthbearerSetToken()

Open bdurkovic opened this issue 8 months ago • 3 comments

Description

The following code:

<?php
                $conf->setOauthbearerTokenRefreshCb(function ($consumer) {
                    $token = $someCorrectTokenValue;
                    $consumer->oauthbearerSetToken($token, $tokenExpiry, 'principalClaimName=azp');
                });

Resulted in this output:

Call to undefined method  RdKafka\KafkaConsumer::oauthbearerSetToken()

But I expected that I can set an OAUTHBEARER token to the consumer.

Am I doing something wrong or is this not supported? As the same code works perfectly for the producer side.

php-rdkafka Version

php-rdkafka 6.0.5

librdkafka Version

No response

PHP Version

PHP 8.4

Operating System

No response

Kafka Version

No response

bdurkovic avatar Mar 27 '25 14:03 bdurkovic

I had the same issue. It seems to me that it's not supported for high-level consumers, but it does work for low-level consumers. Please correct me if I'm wrong

oaattia avatar Apr 06 '25 09:04 oaattia

I've seen your other comment saying that, and I double-checked, and I think you are correct.

With the legacy low-level consumer it is possible and it works, but then other functionality of the high-level consumer is lost.

bdurkovic avatar Apr 07 '25 06:04 bdurkovic

I believe that the low-level consumer is outdated and should no longer be used. We should focus on using the high-level consumer instead. So, why are we still including the low-level consumer in this case?

oaattia avatar Apr 07 '25 08:04 oaattia