private static void LoadConsumersFrom <TBusType, TRoutingType>(this IReceiveEndpointConfigurator configurator, ILifetimeScope rootScope) where TBusType : class, IConsumerBusType where TRoutingType : class, IConsumerRountingType { try { foreach (var consumerType in rootScope.FindConsumerTypes <TBusType, TRoutingType>()) { var scopeProvider = new AutofacConsumerScopeProvider(new SingleLifetimeScopeProvider(rootScope), AutofacExtensions.ServiceBusMessageScopeTag); ConsumerConfiguratorCache.Configure(consumerType, configurator, scopeProvider); } } catch (Exception e) { Log.Error(e, $"Failed to register receive endpoint: {configurator.InputAddress}"); } }
private static bool IsAnyConsumer <TBusType, TRoutingType>(ILifetimeScope rootScope) where TBusType : class, IConsumerBusType where TRoutingType : class, IConsumerRountingType { return(rootScope.FindConsumerTypes <TBusType, TRoutingType>().Any()); }