-
Notifications
You must be signed in to change notification settings - Fork 57
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
DefaultRoutingKeyConvention seems to use GetInterfaces.FirstOrDefault incorrectly #11
Comments
@fhalim do U remember? |
Yes, maybe the interfaces should be sorted to make this a bit more deterministic The problem with this algorithm are slightly bigger. For instance, it'll generate the complete key from the lowest base type before moving on to the interfaces for the next lowest one. Maybe it'd make sense to collect all the interfaces for the type and use that as a sorted list. All this said, collapsing the type hiearchy into a string and doing prefix matching seems inherently problematic. I don't really have a good solution for it other than maybe keeping routing information out of band like we have to do on MSMQ etc. |
Can't come up with a way to fix this. Will open a and document this as a limitation for now |
so this is still a bug in deep nested inheritance changes https://msdn.microsoft.com/en-us/library/system.type.getinterfaces(v=vs.110).aspx
|
The @Particular/rabbitmq-transport-maintainers group discussed this at some length today.
The conclusion we came to is that The only path this leaves open is to remove support for interface based routing in In the meantime we believe we should document the limitation and advise against the use of message types which have interfaces in their inheritance hierarchy when using the In summary, we propose the following:
@SimonCropp we'd appreciate any input you have on this. |
A couple of things
|
Thanks @SimonCropp, those are good points. The offending API is the direct routing topology itself and the deprecation and eventual removal of that depends on the outcome of #270, so I'll reference those points from there. |
@andreasohlund i think there are some problems with this code
https://github.com/Particular/NServiceBus.RabbitMQ/blob/develop/src/NServiceBus.RabbitMQ/Routing/DefaultRoutingKeyConvention.cs#L21
Note we are calling
GetInterfaces
then.FirstOrDefault();
on that resultThe problem is what is returned from
GetInterfaces
is ordered based on the sourceFor example this
Will return
IMyInterface1
as the first fromGetInterfaces
While this
Will return
IMyInterface2
as the first fromGetInterfaces
So from the users perspective their functionality is the same but the routing key will be different.
The text was updated successfully, but these errors were encountered: