public MessageDispatcherService(MessageHandlerFactory factory, MessageHandlerRegistry registry, AsyncMessagingOptions options, IBus bus, ILogger <MessageDispatcherService> logger) { _bus = bus; _subscription = options.Subscription; _registry = registry; _factory = factory; _logger = logger; }
public static IMessageHandlerBuilder AddAsyncMessaging(this IServiceCollection services, IConfiguration configuration) { var subscription = configuration.GetValue("subscription_name", "default"); var options = new AsyncMessagingOptions { Subscription = subscription }; var registry = new MessageHandlerRegistry(); var factory = new MessageHandlerFactory(services); services .AddSingleton(options) .AddSingleton(registry) .AddSingleton(factory) .AddSingleton <MessageDispatcherService>() .AddHostedService <AsyncMessagingService>(); return(new MessageHandlerBuilder(services, registry)); }
public static IMessageHandlerBuilder AddAsyncMessaging(this IServiceCollection services, IConfiguration configuration) { var messageBroker = configuration.GetValue("messagebroker", "host=localhost;username=guest;password=guest;publisherConfirms=true"); var subscription = configuration.GetValue("subscription", "default"); var options = new AsyncMessagingOptions { Subscription = subscription }; var registry = new MessageHandlerRegistry(); var factory = new MessageHandlerFactory(services); services .AddSingleton(options) .AddSingleton <IBus>(RabbitHutch.CreateBus(messageBroker)) .AddSingleton(registry) .AddSingleton(factory) .AddSingleton <MessageDispatcherService>() .AddHostedService <AsyncMessagingService>() .AddHostedService <OutboxProcessor>(); return(new MessageHandlerBuilder(services, registry)); }
public MessageHandlerBuilder(IServiceCollection services, MessageHandlerRegistry registry) { _services = services; _registry = registry; }