raine
raine

Reputation: 857

Explanation for Exchanges created by NServiceBus with RabbitMQ

Exchanges

Can anyone please explain why NServiceBus creates the above RabbitMQ Exchanges along with the expected exchanges based on Handler configuration?

Edit: No IEvent / IMessage / object Handler classes defined. Using DefiningEventAs changes nothing (same exchanges and queues created).

                conf.DefiningEventsAs(
                    t => t.Name.EndsWith("Event") && t.Namespace != null && t.Namespace.EndsWith("Events"))                    
                .DefiningCommandsAs(
                    t => t.Name.EndsWith("Command") && t.Namespace != null && t.Namespace.EndsWith("Commands"))
                .UnicastBus()
                .ImpersonateSender(false);

Referenced assemblies:

We downgraded from a later version (though not the latest, I can't recall which one right now) but nothing changed.

Upvotes: 0

Views: 738

Answers (1)

Andreas Öhlund
Andreas Öhlund

Reputation: 5273

This behavior is by design, we setup all exchanges including IEvent and Object since there could be subscribers that subscribe to all events using a IHandleMessages<IEvent|object> message handler. There is no way for us to know if there are subscribers that has such handlers so therefor we set those exchanges up by default.

They should cause no harm if not used but if you want to get rid of them you canoverride this behavior by implementing your own routing topology, IRoutingTopology that ignores those types. You would then register with the transport using .UseRoutingTopology<MyRoutingTopology>()

Upvotes: 2

Related Questions