Skip to content

Conversation

borisalekseev
Copy link
Collaborator

@borisalekseev borisalekseev commented Oct 16, 2025

Description

Deny register routers in multiple routers or brokers and check if router already registered

Fixes #2587

Type of change

Please delete options that are not relevant.

  • Documentation (typos, code examples, or any documentation updates)
  • Bug fix (a non-breaking change that resolves an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a fix or feature that would disrupt existing functionality)
  • This change requires a documentation update

Checklist

  • My code adheres to the style guidelines of this project (just lint shows no errors)
  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation
  • My changes do not generate any new warnings
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature
  • Both new and existing unit tests pass successfully on my local environment by running just test-coverage
  • I have ensured that static analysis tests are passing by running just static-analysis
  • I have included code examples to illustrate the modifications

@HelgeKrueger
Copy link
Contributor

It might be useful to also comment on https://faststream.ag2.ai/latest/getting-started/routers/ regarding this behavior, e.g.

  • In Section "Delay Handler Registration" comment that the handler array has the advantage of being stateless compared to the router. RabbitRouter having state might be surprising to more people than just me.
  • Provide an example how to test handlers:
async def test_example():
   broker = RabbitBroker(routers=(RabbitRouter(handlers=handlers)))
   async with TestBroker(broker) as tbr:
       await tbr.publish(...)

should allow one to test handlers.

@borisalekseev borisalekseev marked this pull request as draft October 17, 2025 18:22
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.

Bug: Dependency handling for Context breaks for multiple tests

2 participants