π Fixed `bootstrap_streaming` support for `CQRSContainer`
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
CQRSContainersupport tobootstrap_streamingmethod, following the same pattern as other bootstrap methods - Updated
setup_streaming_mediatorto accept bothDIContainerandCQRSContainertypes - Added proper type overloads for better type checking
- The method now correctly handles both
di.ContainerandCQRSContainerinstances:- If
di.Containeris provided, it wraps it inDIContainer() - If
CQRSContaineris provided, it uses it directly
- If
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_streamingwithDependencyInjectorCQRSContainer - 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: AddedCQRSContainersupport tobootstrap_streamingandsetup_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.