Esempio n. 1
0
        public InMemoryEventPublisher(ILogger <InMemoryEventPublisher> logger,
                                      IOptions <InMemoryEventBusOptions> options,
                                      [NotNull] ISubscriptionProvider subscriptionProvider)
        {
            _logger = logger;
            _subscriptionProvider = subscriptionProvider;
            _messageProcessor     = new ActionBlock <SendMessageRequest>(ActionBlockCallback);

            _options = options?.Value ?? new InMemoryEventBusOptions();
        }
Esempio n. 2
0
        public static IServiceCollection AddInMemoryEventBus([NotNull] this IServiceCollection services, InMemoryEventBusOptions busOptions, ServiceLifetime serviceLifetime = ServiceLifetime.Scoped)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services.AddInMemoryEventBus(serviceLifetime);

            busOptions ??= new InMemoryEventBusOptions();

            services.Configure <InMemoryEventBusOptions>(o => busOptions.ConfigureCallback(o));

            return(services);
        }
 public InMemorySubscriptionProvider(ILogger <InMemorySubscriptionProvider> logger,
                                     IOptions <InMemoryEventBusOptions> options)
 {
     _logger  = logger;
     _options = options?.Value ?? new InMemoryEventBusOptions();
 }