开发者

How to configure MessageEndpointMapping by namespace in NServiceBus

开发者 https://www.devze.com 2022-12-25 15:17 出处:网络
I am trying to configure my message endpoint mapping in my NServiceBus configuration by sending messages from different namespaces to different endpoints.

I am trying to configure my message endpoint mapping in my NServiceBus configuration by sending messages from different namespaces to different endpoints.

As such, I have configured the following in my web.config:

<MessageEndpointMappings>
    <add Messages="Company.Messages.Accounts" Endpoint="ServiceInput" />
    <add Messages="Company.Messages.Payments" Endpoint="ServiceInput" />
    <add Messages="Company.Messages.Cancellations" Endpoint="ServiceInput" />
    <add Messages="Company.Messages.Notifications" Endpoint="ServiceInput" />
</MessageEndpointMappings>

However, when my application starts, I receive the following exception:

Spring.Objects.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested PropertyAccessExceptions are: [Spring.Core.TypeMismatchException: Cannot convert property value of type [System.Collections.Hashtable] to required type [System.Collections.IDictionary] for property 'MessageOwners'., Inner Exception: System.ArgumentException: Problem loading message assembly: Company.Messages.Payments ---> System.IO.F开发者_StackOverflowileNotFoundException: Could not load file or assembly 'Company.Messages.Payments' or one of its dependencies. The system cannot find the file specified. File name: 'Company.Messages.Payments'

What I find interesting is that it seems to have found Company.Messages.Accounts but failed on the second configured line. I thought that maybe it didn't like have them all go to the same endpoint, but changing this configuration to have them go different endpoints didn't change the error message I received.

What am I doing wrong? Is it not possible to segment messages by namespace (all I have seen is by type and by assembly)?

Thanks, Steve


NSB only supports mapping of assemblies or individual types to endpoints. Namespaces are not supported, I suggest you split you message assembly into separate assemblies for each of your endpoints.


According to this page you can specify a type: http://docs.particular.net/nservicebus/messaging/message-owner

Specific types can be configured by using their qualified name: "namespace.type, assembly".


As of NServiceBus v3.3 namespaces can be used to filter message mappings

http://docs.particular.net/nservicebus/messaging/message-owner

0

精彩评论

暂无评论...
验证码 换一张
取 消