Ryan Tomlinson
Ryan Tomlinson

Reputation: 884

How to handle only specific messages using NServiceBus Host

I have a seperate class library of messages. Each handler implementing IHandleMessages. I also have a seperate class library that uses the NServiceBus.Host to act as a message handling service. I know I can handle the ordering of messages but can I say which message handlers I want the host to handle? At the minute it seems that any reference to IHandleMessage will be handled by the host

Upvotes: 0

Views: 182

Answers (2)

Adam Fyles
Adam Fyles

Reputation: 6050

You can custom initialize your endpoint and use the With(IEnumerable<Type> typesToScan) overload. You will need to include the NSB types as well. I would recommend splitting up the assembly into multiple assemblies and then use the With(IEnumberable assemblies) overload to simplify the process. You could still deploy all handlers, but just configure endpoints to use a specific set.

Upvotes: 1

tom redfern
tom redfern

Reputation: 31750

Why not just have one handler per NServiceBus host? Makes it nice and easy.

Upvotes: 0

Related Questions