/// <summary> /// Create IServiceBus Factory /// </summary> /// <returns></returns> SimpleServiceBusFactory CreateFactory() { //var settings = _container.Resolve<IRabbitMqSettings>(); // var application = _container.Resolve<IApplicationSettings>(); var connectionString = ""; var servicesFactory = new SimpleServiceBusFactory(_container, connectionString); return servicesFactory; }
/// <summary> /// Create The Bus Using Factory To Scan The Container For Handlers /// Register The Bus In The Container /// </summary> /// <param name="configure"></param> /// <param name="serviceBusFactory"></param> void CreateBusAndRegisterInContainer(Action<ServiceBusConfigurator> configure, SimpleServiceBusFactory serviceBusFactory) { _container.Register ( Component.For<IServiceBus>() .UsingFactoryMethod(c => serviceBusFactory.Create(configure)) .LifeStyle .Singleton ); }