-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OnEventStrategy needs to handle custom message names better #109
Comments
I would not call the last two examples weird but an interesting feature :D |
two options:
|
I usually have an projector class, that handles all projections for a given AR. When I use messages as string or array, I cannot have distinct methods to handle projection updates any more, as every message would like to call onString / onArray. Better would be onEvent() f.e., if there is no way to know the message name. |
Perhaps the OnEventStrategy uses the classname only, and if the event is no class or uses special method name that should be used for the OnEventStrategy, too, you should write your own Userland-Strategy. Too many checks and validations will degrade performance and next week we find even more problems like this. |
hhm I need to think about it. Problem is, our message interface explicitly allows custom message names. Your are not forced to use one class per message. When we now limit our invoke strategies to only work with FQCNs why should we allow custom message names then? On the other hand I agree with you that custom names can be handled with custom invoke strategies. The service bus system is flexible enough to handle it. |
Let's simply change the OnEventStrategy and also in the AggregateRoot::determineEventHandlerMethodFor and remove all this automation completely. We can simply work with something like this instead (here example from aggregate root):
When people want to have the old behaviour back, they can simply:
But this solves all these problems with a single code change. thoughts @codeliner ? |
Based on discussion at #108:
If message names with " ", and ".", and messages are no objects but string, array, leads to confusing behaviour, as the invoke method uses on + short message name.
Some examples:
The text was updated successfully, but these errors were encountered: