コード例 #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();
        }
コード例 #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);
        }
コード例 #3
0
 public InMemorySubscriptionProvider(ILogger <InMemorySubscriptionProvider> logger,
                                     IOptions <InMemoryEventBusOptions> options)
 {
     _logger  = logger;
     _options = options?.Value ?? new InMemoryEventBusOptions();
 }