Add FastStream example to docs#958
Open
birthdaysgift wants to merge 3 commits intoets-labs:developfrom
Open
Conversation
ZipFile
requested changes
Apr 17, 2026
Comment on lines
+3
to
+4
| FastStream example | ||
| ============= |
Contributor
There was a problem hiding this comment.
Suggested change
| FastStream example | |
| ============= | |
| FastStream example | |
| ================== |
Comment on lines
+21
to
+24
| counter = providers.Singleton(Counter) | ||
|
|
||
|
|
||
| broker = RedisBroker("redis://redis", logger=None) |
Contributor
There was a problem hiding this comment.
Suggested change
| counter = providers.Singleton(Counter) | |
| broker = RedisBroker("redis://redis", logger=None) | |
| config = providers.Configuration() | |
| counter = providers.Singleton(Counter) | |
| broker = providers.Resource(RedisBroker, config.redis_url, logger=None) | |
| app = providers.Factory(FastStream, broker, logger=None) |
If we're demonstrating integration, it would be better to go all-out.
Comment on lines
+51
to
+52
|
|
||
| await FastStream(broker, logger=None).run() |
Contributor
There was a problem hiding this comment.
see comment above
Suggested change
| await FastStream(broker, logger=None).run() | |
| app = await container.app() | |
| await app.run() |
|
|
||
|
|
||
| def main(): | ||
| client = redis.Redis(host="redis", port=6379) |
Author
There was a problem hiding this comment.
yes, for the sake of simplicity)
since we already have fastapi-redis example do you think this example needs DI container for redis as well?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Despite
FastStreamusesFastDependsunder the hood the existing example forFastDependsfrom documentation doesn't work out of the box when used inFastStreamhandlers.So I thought that having an explicit example of how to use
dependency_injectorwithFastStreamwould be helpful for other devs seeking for a solution for such integration.