public RabbitMQMemoryBus(IRabbitMQChannelFactory channelFactory, RabbitMQOptions options, ISubscriptionManager subscriptionManager, IIntegrationEventAggregation integrationEventAggregation) { _channelFactory = channelFactory; _subscriptionManager = subscriptionManager; _integrationEventAggregation = integrationEventAggregation; _queueName = options.QueueName; Logger = NullLogger <RabbitMqChannelFactory> .Instance; InitializeQueue(); }
public static IServiceCollection AddRabbitMq(this IServiceCollection serviceCollection, RabbitMQOptions options, params Assembly[] eventHandlersAssemblies) { serviceCollection.AddTransient <RabbitMQOptions>(provider => options); serviceCollection.AddSingleton <ISubscriptionManager, SubscriptionManager>(); serviceCollection.AddSingleton <IRabbitMQChannelFactory, RabbitMqChannelFactory>(); serviceCollection.AddSingleton <IRabbitMQMemoryBus, RabbitMQMemoryBus>(); serviceCollection.AddSingleton <IntegrationEventHandlerFactory>(provider => (t) => provider.GetService(t)); serviceCollection.RegisterGenericType(typeof(IIntegrationEventHandler <>), ServiceLifetime.Transient, eventHandlersAssemblies); serviceCollection.RegisterAssembly(typeof(IDynamicIntegrationEventHandler), ServiceLifetime.Transient, eventHandlersAssemblies); serviceCollection.AddSingleton <IIntegrationEventAggregation, IntegrationEventAggregation>(); return(serviceCollection); }
public RabbitMqChannelFactory(RabbitMQOptions rabbitMqOptions) { _rabbitMqOptions = rabbitMqOptions; Logger = NullLogger <RabbitMqChannelFactory> .Instance; }