Skip to content

fix: resolve Context() injections from the broker context - #9

Open
magicabdel wants to merge 1 commit into
faststream-community:developfrom
magicabdel:fix/context-injection-broker-context
Open

magicabdel wants to merge 1 commit into
faststream-community:developfrom
magicabdel:fix/context-injection-broker-context

Conversation

@magicabdel

Copy link
Copy Markdown

Fixes #8.

FastStreamAPI gave _subscriber_compatibility_wrapper the application's own ContextRepo, but FastStream sets the per-message values (message, …) on the broker's context. As a result, every Context() injection in a subscriber, message: RabbitMessage included, resolved to EmptyPlaceholder. This passes broker.context instead, the context faststream's former in-tree FastAPI integration resolved from.

I checked it with the reproduction from #8 (faststream 0.7.8, FastAPI 0.162.0):

  • before: {'type': 'EmptyPlaceholder', 'headers': None}
  • after: {'type': 'RabbitMessage', 'headers': {'x-test': '1'}}

FastStream sets the per-message values (message, ...) on the broker's context, so Context() injections such as `message: RabbitMessage` resolved to EmptyPlaceholder.

Fixes faststream-community#8

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Context injection (e.g. message: RabbitMessage) resolves to EmptyPlaceholder in FastStreamAPI subscribers

1 participant