Closed tyx closed 7 years ago
As the command handler should be the latest we could also remove the necessity to specify it and add it automatically
Agreed.
Good changes, thanks for doing this!
Re: auto-adding this... It was discussed a bit in the beginning but the thing is: some folks write custom middleware for executing commands in their own style (in all honesty, we should probably encourage this more rather than adding more config options).
Since the "execution" middlewares (the ones that do the actual handling) are the last ones in the list and don't call any further ahead, it's probably not broken to add one more onto legacy cases but it probably feels a bit sloppy to folks?
What I've thought about for Tactician2 is adding a specific Router object that you pass into command bus constructor (as a separate parameter than the middlewares) and that's the one that does the actual execution and it's always last. We lose kind of that beautiful "everything is a middleware" symmetry in the codebase but it probably becomes a lot easier to understand for folks. We can also let them implement than own routers and those would become easier to dump/debug/wire in standard ways; meaning we could easily port stuff like the Symfony naming conventions to other frameworks with far far less work than it would take right now. (Again, most folks could do this stuff by creating their own execution middleware that they pass the DI container into but very few folks are doing it).
Anyways, this is off topic and all just a spitball right now. We should probably make a separate ticket or take it up on the roadmap issue.
Either way, thanks a ton for this doc improvement, good reaction to the initial support issue. ❤️
adding a specific Router object that you pass into command bus constructor (as a separate parameter than the middlewares) and that's the one that does the actual execution and it's always last. We lose kind of that beautiful "everything is a middleware" symmetry in the codebase but it probably becomes a lot easier to understand for folks
:+1:
Wild feature idea: what about a simple
command_handler
placeholder that will be normalized into the propertactician.commandbus.{bud}.middleware.command_handler
service id by theConfiguration
?So you'll just have to write: