You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm facing with problem. I implemented AbstractTokenProvider for my producer client. But I also need to create and delete topics. From my understanding, I can perform these actions only with kafka-python package, which only supports non-async function calls. It is recommended to use this code in the documentation:
from aiokafka.abc import AbstractTokenProvider
class CustomTokenProvider(AbstractTokenProvider):
async def token(self):
return asyncio.get_running_loop().run_in_executor(
None, self._token)
def _token(self):
# The actual synchoronous token callback.
But I get an error if I try use my class for configure sasl_oauth_token_provider for KafkaAdminClient in package kafka-python: kafka\conn.py:824: RuntimeWarning: coroutine 'AsyncCustomTokenProvider.token' was never awaited
And about my question. Can I implement my case using only one AbstractTokenProvider? Or I must implement Async class for aiokafka and implement Sync class for kafka-python. Thanks for any advice.
This discussion was converted from issue #916 on October 25, 2023 08:47.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, I'm facing with problem. I implemented
AbstractTokenProvider
for my producer client. But I also need to create and delete topics. From my understanding, I can perform these actions only withkafka-python
package, which only supports non-async function calls. It is recommended to use this code in the documentation:In my implementation, it looks like:
But I get an error if I try use my class for configure
sasl_oauth_token_provider
forKafkaAdminClient
in packagekafka-python
:kafka\conn.py:824: RuntimeWarning: coroutine 'AsyncCustomTokenProvider.token' was never awaited
And about my question. Can I implement my case using only one
AbstractTokenProvider
? Or I must implement Async class foraiokafka
and implement Sync class forkafka-python
. Thanks for any advice.Beta Was this translation helpful? Give feedback.
All reactions