public bool Start(HostControl hostControl) { if (_log.IsInfoEnabled) { _log.InfoFormat("Creating bus for hosted service: {0}", _serviceName); } try { _busControl = _hostBusFactory.CreateBus(_serviceConfigurator, _serviceName); _busHandle = TaskUtil.Await(() => _busControl.StartAsync()); if (_log.IsInfoEnabled) { _log.InfoFormat("Created bus for hosted service: {0}", _serviceName); } return(true); } catch (Exception ex) { if (_log.IsErrorEnabled) { _log.Error($"Creating bus for hosted service: {_serviceName}", ex); } throw; } }
public bool Start(HostControl hostControl) { _busControl = _hostBusFactory.CreateBus(_serviceConfigurator, _serviceName); _busHandle = TaskUtil.Await(() => _busControl.StartAsync()); return(true); }
public BusProvider(IHostBusFactory hostBusFactory, IBusServiceConfigurator busServiceConfigurator) { // ReSharper disable once JoinNullCheckWithUsage // Justification: This formatting looks better if (hostBusFactory == null) { throw new ArgumentNullException(nameof(hostBusFactory)); } if (busServiceConfigurator == null) { throw new ArgumentNullException(nameof(busServiceConfigurator)); } // The 'serviceName' argument is not used in RabbitMq and AzureBus // only uses it when its settings are null. So assume their settings // are not null and therefore our argument can be empty. _busControl = hostBusFactory.CreateBus(busServiceConfigurator, string.Empty); _busControl.Start(); }