Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Cant obtain an AsyncAPIDefaultSubscriber object, when using Kafka and FastAPI #1640

Closed
JohannT9527 opened this issue Aug 5, 2024 · 2 comments · Fixed by #1649
Closed
Labels
bug Something isn't working Core Issues related to core FastStream functionality and affects to all brokers

Comments

@JohannT9527
Copy link

Describe the bug

The subscriber method of the KafkaRouter class is annotated with the return type AsyncAPIDefaultSubscriber, but the actual return type is function.

How to reproduce
Include source code:

from fastapi import FastAPI
from faststream.kafka.fastapi import KafkaRouter


router = KafkaRouter()

subscriber = router.subscriber('test_in')
print(f'real type is {type(subscriber)}')


app = FastAPI(lifespan=router.lifespan_context)
app.include_router(router)

And/Or steps to reproduce the behavior:

Execute the above code

@JohannT9527 JohannT9527 added the bug Something isn't working label Aug 5, 2024
@JohannT9527
Copy link
Author

JohannT9527 commented Aug 5, 2024

I want to obtain an AIOKafkaConsumer object from the AsyncAPIDefaultSubscriber object, or is there another way to obtain an AIOKafkaConsumer object?

@Lancetnik
Copy link
Member

Sorry, I just didn't refactored FastAPI integration since 0.5.0 release yet. We should make it the same with regular router.subscriber() behavior

@Lancetnik Lancetnik added the Core Issues related to core FastStream functionality and affects to all brokers label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Core Issues related to core FastStream functionality and affects to all brokers
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants