12

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.FileNotFoundException: 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

Dylan Beattie
  • 53,688
  • 35
  • 128
  • 197
SteveBering
  • 947
  • 1
  • 12
  • 30

3 Answers3

13

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.

Andreas Öhlund
  • 5,263
  • 20
  • 24
5

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".

Simon
  • 33,714
  • 21
  • 133
  • 202
mark w
  • 81
  • 2
  • Great to include link. I never read the pub sub example because I didn't need it yet, however I havn't seen that little tid-bit anywhere else in the docs. – etropic Sep 28 '12 at 01:13
0

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

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

Simon
  • 33,714
  • 21
  • 133
  • 202
Andreas Öhlund
  • 5,263
  • 20
  • 24
  • Perhaps the doco should also point out that NServiceBus (4.7 is the version I'm using!) also fails if I add the Image extension (*.dll in my case). Quite counter-intuitive! – agAus Oct 14 '15 at 23:49
  • We have the note here: http://docs.particular.net/nservicebus/messaging/message-owner#2-resolving-the-messages-types-to-map-resolving-with-the-assembly Any ideas on have we can make it more clear? – Andreas Öhlund Oct 15 '15 at 08:02