Skip to content

πŸ› Fixed `bootstrap_streaming` support for `CQRSContainer`

Choose a tag to compare

@vadikko2 vadikko2 released this 23 Jan 09:51
· 27 commits to master since this release
47c2909

Release Notes - Version 4.6.1

πŸ› Bug Fixes

Fixed bootstrap_streaming support for CQRSContainer

Issue: The bootstrap_streaming method did not support CQRSContainer (like DependencyInjectorCQRSContainer), unlike other bootstrap methods (bootstrap for requests, events, and sagas). This caused errors when trying to use DependencyInjectorCQRSContainer with streaming mediators:

'DependencyInjectorCQRSContainer' object has no attribute 'solve'

Fix:

  • Added CQRSContainer support to bootstrap_streaming method, following the same pattern as other bootstrap methods
  • Updated setup_streaming_mediator to accept both DIContainer and CQRSContainer types
  • Added proper type overloads for better type checking
  • The method now correctly handles both di.Container and CQRSContainer instances:
    • If di.Container is provided, it wraps it in DIContainer()
    • If CQRSContainer is provided, it uses it directly

Impact: Users can now use DependencyInjectorCQRSContainer and other CQRSContainer implementations with bootstrap_streaming, enabling dependency injection integration with streaming request handlers.

βœ… Testing

  • Added comprehensive test suite for bootstrap_streaming with DependencyInjectorCQRSContainer
  • Tests cover:
    • Basic streaming functionality with dependency injection
    • Event processing with dependency injection
    • Parallel event handling with dependency injection
    • Interface-based dependency resolution

πŸ“ Technical Details

Files Changed:

  • src/cqrs/requests/bootstrap.py: Added CQRSContainer support to bootstrap_streaming and setup_streaming_mediator

New Files:

  • tests/unit/test_bootstrap_streaming_dependency_injector.py: Comprehensive test suite for the new functionality

πŸ”„ Migration Guide

No migration required. This is a backward-compatible bug fix. Existing code using di.Container will continue to work as before. Code using CQRSContainer with bootstrap_streaming will now work correctly.