Skip to content
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

Identical Consumer class names in different namespaces do not create seperate endpoints #2030

Closed
maartenvana opened this issue Aug 28, 2020 · 3 comments

Comments

@maartenvana
Copy link

maartenvana commented Aug 28, 2020

Is this a bug report?

I think it could be classified as a bug

Can you also reproduce the problem with the latest version?

Yes

Environment

Irrelevant

Steps to Reproduce

(Write your steps here:)

  1. Create 3 seperate projects (or use different namespaces)
  2. Create Producer in project/ns 1 that produces a Message
  3. Create a Consumer in project/ns 2 with a consumer class MessageConsumer : IConsumer
  4. Create a Consumer in project/ns 3 with the same consumer class MessageConsumer : IConsumer

Expected Behavior

I Expect both consumers to get their own message

Actual Behavior

One consumer gets a message the other does not.

Reproducible Demo

If needed I can provide it. But I think its easy to reproduce. Just look at the DefaultEndpointNameFormatter class

Remarks

We can fix this with a custom endpoint name formatter, but I believe in "falling in the pit of success" and this is a timebomb waiting to happen in small or big teams if one happens to name consumers the same in different projects or even namespaces.

Why is not at least something like the namespace or something else included in the name by default? I'd like to see it at least mentioned in the docs in a red section since it can really screw up your day/week/weekend if not taken care of.

In my situation I've prefixed the consumers by overwriting the DefaultEndpointNameFormatter with the service name in the SanitizeName method, since I do want to preserve the rest of the default handling of endpoint names

@phatboyg
Copy link
Member

A change like this would break everyone currently using MassTransit. So it's unlikely to ever become the default behavior.

As you stated, the default endpoint name formatter can be replaced. Adding an option to the current name formatters to include the namespace (or even some arbitrary prefix) to the names would be a reasonable addition to the current behavior.

@maartenvana
Copy link
Author

Yes, that also occurred to me it would probably break alot of projects if it was to be changed. An addition to the default formatter plus a warning/note in the docs is a welcome change :)

@phatboyg
Copy link
Member

Please make any future comments to the other issue.

@MassTransit MassTransit locked and limited conversation to collaborators Aug 28, 2020
@phatboyg phatboyg reopened this Aug 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants