NServiceBus 5 with the exclusive exception of the RabbitMQ transport route, allowing UnicastBus

I am trying to use NServiceBus with RabbitMQ in self-service. I got a source for NSServiceBus and NServiceBus.RabbitMQ repos on github to keep track of the issues I have had so far, so the version used is the source of their repos as of yesterday.

Here is my configuration:

        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);

I get an exception in the line Bus.Create():

{"The given key (NServiceBus.LocalAddress) was not present in the dictionary."}

Having a stack from it leads me to the fact that it does not work when turned on Feature UnicastBus.

Here is my application configuration:

<?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="RMAQueue@localhost" />
    </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>

What am I missing to be able to start NServiceBus on my own using the RabbitMQ transport?

+1
source share
2

, , . :

configuration.AssembliesToScan(typeof(NServiceBus.Transports.RabbitMQ.IManageRabbitMqConnections).Assembly);

, NServiceBus.LocalAddress, . (, )

[TestMethod]
public void TestMethod1()
{
    LogManager.Use<Log4NetFactory>();
    var configuration = new BusConfiguration();
    configuration.AssembliesToScan(typeof(NServiceBus.Transports.RabbitMQ.IManageRabbitMqConnections).Assembly);
    configuration.UseSerialization<JsonSerializer>();
    configuration.UseTransport<NServiceBus.RabbitMQTransport>();
    configuration.UsePersistence<InMemoryPersistence>();

    var bus = global::NServiceBus.Bus.Create(configuration);
    bus.Start();
}



<?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="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, Log4net" />
  </configSections>

  <MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />

  <connectionStrings>
    <add name="NServiceBus/Transport" connectionString="host=localhost" />
  </connectionStrings>

  <UnicastBusConfig>
    <MessageEndpointMappings>
      <add Assembly="TestNSBCreation" Endpoint="TestNSBCreation" />
    </MessageEndpointMappings>
  </UnicastBusConfig>

  <log4net>
    <root>
      <level value="DEBUG" />
      <appender-ref ref="LogFileAppender" />
      <appender-ref ref="ContactAppender" />
    </root>
    <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
      <param name="File" value="C:\logs\TestNSBCreation.log" />
      <param name="AppendToFile" value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="5" />
      <maximumFileSize value="10MB" />
      <staticLogFileName value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
      </layout>
    </appender>
  </log4net>

</configuration>
+2

. configuration.AssembliesToScan(typeof(NServiceBus.Transports.RabbitMQ.IManageRabbitMqConnections).Assembly);

. NServiceBus.RabbitMQ RabbitMQ.Client. , nuget, NserviceBus.RabbitMQ , . NserviceBus.RabbitMQ, . ..assembliesToScan... .

+1

All Articles