2014-02-12 58 views

回答

0

不幸的是,由於一個bug(見https://github.com/Particular/NServiceBus/issues/1960),唯一可行的方法就是以編程方式替換整個UnicastBusConfig,如:

class Foo : IProvideConfiguration<UnicastBusConfig> 
{ 
    public UnicastBusConfig GetConfiguration() 
    { 
     var unicastBusConfig = new UnicastBusConfig 
     { 
      ForwardReceivedMessagesTo = "FooBar", 
     }; 
     unicastBusConfig.MessageEndpointMappings = new MessageEndpointMappingCollection(); 
     unicastBusConfig.MessageEndpointMappings.Add(...); 

     return unicastBusConfig; 
    } 
} 

但是,這是很醜陋:(

相關問題