NServiceBus icon indicating copy to clipboard operation
NServiceBus copied to clipboard

Configure.With(types) fails for RabbitMQ transport

Open JustinThirkell opened this issue 13 years ago • 2 comments

this Configuration throws an exception:

Configure.With(types).UseTransport(RabbitMQ);

Exception message is: "We couldn't find a IConfigureTransport implementation for your selected transport: RabbitMQ" and I can see a couple of messages missing in the Config.InfrastructureServices logs - I guess some defaults aren't being set when custom scanning is in play...?

Missing messages from logs (these appear when using default scanning): "Default provider for infrastructure service NServiceBus.Transports.RabbitMQ.Routing.IRoutingTopology has been set to NServiceBus.Transports.RabbitMQ.Routing.ConventionalRoutingTopology, lifecycle: SingleInstance" and "Default provider for infrastructure service NServiceBus.Transports.RabbitMQ.IManageRabbitMqConnections has been set to a custom action"

JustinThirkell avatar May 14 '13 07:05 JustinThirkell

Yes you need to include the types is the Rabbit transport dll in the scanning. Does that solve the issue?

On Tue, May 14, 2013 at 9:48 AM, Justin Thirkell [email protected]:

this Configuration throws an exception:

Configure.With(types).UseTransport(RabbitMQ);

Exception message is: "We couldn't find a IConfigureTransport implementation for your selected transport: RabbitMQ" and I can see a couple of messages missing in the Config.InfrastructureServices logs - I guess some defaults aren't being set when custom scanning is in play...?

Missing messages from logs (these appear when using default scanning): "Default provider for infrastructure service NServiceBus.Transports.RabbitMQ.Routing.IRoutingTopology has been set to NServiceBus.Transports.RabbitMQ.Routing.ConventionalRoutingTopology, lifecycle: SingleInstance" and "Default provider for infrastructure service NServiceBus.Transports.RabbitMQ.IManageRabbitMqConnections has been set to a custom action"

— Reply to this email directly or view it on GitHubhttps://github.com/NServiceBus/NServiceBus/issues/1174 .

http://andreasohlund.net http://twitter.com/andreasohlund

andreasohlund avatar May 14 '13 08:05 andreasohlund

yes, it does thanks. i'm forcing it to pick up the assembly containing the transportType (we're switching transports via config at the moment until we settle on one).

        static Configure ConfigureNsbWithScannedTypes(BootstrapperConfiguration config, Type transportType) {
            var assembliesToScan = 
                // pick up all MyCompany* assemblies for the moment - maybe one day we'll restrict these to MyCompany.*.Events and MyCompany.*.Commands assemblies...
                AllAssemblies.Matching("MyCompany.")
                // need to include transport types and the MyCompany.Bus assembly
                .Concat(new[] {transportType.Assembly, typeof(MyCompany.Bus.IBus).Assembly});
            if (config.AssembliesToScan != null) {
                assembliesToScan = assembliesToScan
                    .Concat(config.AssembliesToScan);
            }
            var typesToScan = assembliesToScan.SelectMany(a => a.GetTypes());
            if (config.TypesToScan != null) {
                typesToScan = typesToScan
                    .Concat(config.TypesToScan);
            }
            return Configure.With(typesToScan);
        }

JustinThirkell avatar Jun 11 '13 06:06 JustinThirkell