Amir Jalali
Amir Jalali

Reputation: 3212

MassTransit Multiple Consumers All Receive Same Message in different name spaces?

Environment:
 Three Projects (one publisher and three subscribers):
   consoleConsumer1
   consoleConsumer2
   consolePublisher1

The publisher send the message through the publishendpoint in consolePublisher1 namespace

_publishEndPoint.Publish<ManagerCreated>()

And I have two other projects, surely with two different namespaces that accidentally have the same consumer name for handing ManagerCreated Event so normally i have added this consumer

    mt.AddConsumer<ManagerChangedIntegrationEventHandler>();

i would expect that masstransit creates two fanout exchanges and queues with names like these

consoleConsumer1:ManagerChangedIntegrationEventHandler
and
consoleConsumer2:ManagerChangedIntegrationEventHandler

but it only creates one fanout exchange named:

ManagerChangedIntegrationEventHandler

which these two consumers compete to consume messages. I know I can create queue endpoint so that an exchange publishes the message to two different queues but is there any way that this happen by convention?

and why shouldn't project name or namespace effect the exchange and queue name?

what is the best way of using namespaces in consumers registration?

Upvotes: 0

Views: 283

Answers (1)

Chris Patterson
Chris Patterson

Reputation: 33298

There was an issue already created for this, and the ability to include the namespace using any of the endpoint name formatters will be available in the next release.

Upvotes: 1

Related Questions