Agreement Dispatcher
Overview
Standard vs Agreement Dispatcher Routing
Standard 1-to-1 Routing (Default)
services.AddBrighter(options => { })
.Handlers(registry =>
{
// Fixed mapping: MyCommand always goes to MyCommandHandler
registry.Register<MyCommand, MyCommandHandler>();
});Agreement Dispatcher Routing
Use Cases
1. Time-Based Routing
2. Country-Specific Business Logic
3. Order Journey Based on Contents
4. Versioning and Migration
5. State-Based Routing
Registration Syntax
Basic Registration
Accessing Request Content
Accessing Request Context
Returning Multiple Handlers
Synchronous and Asynchronous Registration
Synchronous Registration
Asynchronous Registration
Limitations
Cannot Use AutoFromAssemblies
Handler Types Must Be Provided
Performance Implications
Overhead Breakdown
Performance Considerations
Integration with Dynamic Message Deserialization
Complete Example
Best Practices
1. Keep Routing Logic Simple
2. Provide Clear Error Messages
3. Document Routing Rules
4. Use Standard Routing When Possible
5. List All Possible Handlers
Troubleshooting
Handler Not Found Error
AutoFromAssemblies Conflicts
Further Reading
Sample Code
Last updated
Was this helpful?
