我試圖在自託管方案中使用NServiceBus與RabbitMQ的。我已經在github上獲得了NServiceBus和NServiceBus.RabbitMQ repos的源代碼,以便跟蹤我迄今爲止所遇到的問題,所以我使用的版本是昨天在其回購站中的源代碼。NServiceBus 5 RabbitMQ的交通引發異常,同時使UnicastBus
這裏是我的配置:
var busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("RMAQueue");
busConfiguration.AssembliesToScan(typeof(RMACommand).Assembly);
busConfiguration.Conventions()
.DefiningCommandsAs(type => type.Namespace != null && type.Namespace.StartsWith("RMAInterfaces.Commands.", StringComparison.Ordinal));
busConfiguration.Conventions()
.DefiningEventsAs(type => type.Namespace != null && type.Namespace.StartsWith("RMAInterfaces.Events.", StringComparison.Ordinal));
busConfiguration.Conventions()
.DefiningMessagesAs(type => type.Namespace != null && type.Namespace.StartsWith("RMAInterfaces.Messages.", StringComparison.Ordinal));
busConfiguration.UseTransport<RabbitMQTransport>();
busConfiguration.Transactions().Disable();
busConfiguration.PurgeOnStartup(true);
busConfiguration.UseSerialization<NServiceBus.JsonSerializer>();
busConfiguration.DisableFeature<SecondLevelRetries>();
busConfiguration.DisableFeature<StorageDrivenPublishing>();
busConfiguration.DisableFeature<TimeoutManager>();
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.EnableInstallers();
var bus = Bus.Create(busConfiguration);
我得到一個異常的Bus.Create()
行:
{"The given key (NServiceBus.LocalAddress) was not present in the dictionary."}
繼堆棧它使我看到,它同時使Feature
UnicastBus
真實失敗。
這裏是我的應用程序配置:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
<section name="AuditConfig" type="NServiceBus.Config.AuditConfig, NServiceBus.Core" />
</configSections>
<MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="RMAInterfaces" Endpoint="[email protected]" />
</MessageEndpointMappings>
</UnicastBusConfig>
<connectionStrings>
<add name="NServiceBus/Transport" connectionString="host=localhost" />
<add name="NServiceBus/Persistence" connectionString="host=localhost"/>
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<!--<AuditConfig
QueueName="The address to which messages received will be forwarded."
OverrideTimeToBeReceived="The time to be received set on forwarded messages, specified as a timespan see http://msdn.microsoft.com/en-us/library/vstudio/se73z7b9.aspx" />-->
<AuditConfig QueueName="audit" />
</configuration>
我缺少的是能夠自我主機NServiceBus使用RabbitMQ的運輸?
您可以包括NServiceBus.RabbitMQ.dll在assemblyscanning,看看是否可行? – 2014-12-03 21:43:58
與http://stackoverflow.com/questions/29081094/why-is-nservicebus-configuration-broken-after-using-typestoscan相同 – 2015-04-09 08:18:03