Skip to content

Need help with unusual use case: publish-only app #1133

Answered by Lancetnik
fyber asked this question in Q&A
Discussion options

You must be logged in to vote

If you want to just a publish messages, you can use smth like

async with KafkaBroker() as broker:
    await broker.publish(...)

In any code you want.

Direct broker.publisher().publish(...) is just a trick to generate AsyncAPI schema based on your app.

I think, the preffered way in your case is do not use FastStream application object (if you need no AsyncAPI documentation of your service) and just write your own service with broker.publish(...) usage

But, if you want to have a doc, you should create regular FastStream app (withour any subscribers) and start endless task in app.on_startup hook

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fyber
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants