Closed arrkaye closed 7 years ago
Hello @riazkarim - thanks for reporting this!
You could register the RawRabbitConfiguration
in the Action<IServiceCollection>
. Here's a snippet I've using to that end
public class RawRabbitFactory
{
public static IBusClient GetDefaultBusClient(string connectionStrName = "RabbitMq", Action<IServiceCollection> overrides = null)
{
var config = ExtractConfigFromConnectionString(connectionStrName); // uses ConnectionStringParser
overrides = overrides ?? (collection => { });
overrides += collection => collection.AddSingleton(typeof(RawRabbitConfiguration), p => config);
return BusClientFactory.CreateDefault(overrides);
}
}
This, then, can be used like below.
RawRabbitFactory.GetDefaultBusClient(
"RabbitMq",
ioc => ioc.AddSingleton<ILoggerFactory, LoggerFactory>()
);
Hope this helps!
I'll close this for now. Feel free to re-open if the problem isn't solved!
Thanks! That worked.
Am using:
return BusClientFactory.CreateDefault(ConnectionStringParser.Parse(_configurationProvider.CommunicationOptions.ConnectionString));
I'm not sure how to inject Serilog. Please can you advise?
Thanks.