Пример #1
0
 public BusHost(IBusControl busControl,
                ILogger <BusHost> logger,
                BusHostConfig config,
                MessageConsumptionAuditObserver consumingAuditObserver,
                MessagePublishingAuditObserver publishingAuditObserver,
                MessageSendingAuditObserver sendingAuditObserver)
 {
     _busControl              = busControl;
     _logger                  = logger;
     _config                  = config;
     _consumingAuditObserver  = consumingAuditObserver;
     _publishingAuditObserver = publishingAuditObserver;
     _sendingAuditObserver    = sendingAuditObserver;
 }
Пример #2
0
        public static IServiceCollection AddMassTransitBusHost(this IServiceCollection services, Action <BusHostConfig> configSetup = null)
        {
            var config = new BusHostConfig();

            configSetup?.Invoke(config);

            services.AddSingleton(config);

            services.AddTransient <MessageConsumptionAuditObserver>();
            services.AddTransient <MessagePublishingAuditObserver>();
            services.AddTransient <MessageSendingAuditObserver>();
            services.AddTransient <MessageRetryAuditObserver>();

            services.AddHostedService <BusHost>();

            return(services);
        }