Пример #1
0
        public static IServiceCollection AddEventBus(this IServiceCollection serviceCollection, Action <EventBusBuilder> builderAction)
        {
            var eventBusBuilder = new EventBusBuilder();

            builderAction.Invoke(eventBusBuilder);
            return(serviceCollection.AddSingleton <IEventBus>((serviceProvider) => {
                return eventBusBuilder.Build(serviceProvider);
            }));
        }
Пример #2
0
        public static EventBusBuilder UseAzureServiceBus(this EventBusBuilder builder, string connectionString,
                                                         string topic, string subscription, Action <ServiceBusOptions> optionsAction = null)
        {
            var options = new ServiceBusOptions();

            optionsAction?.Invoke(options);

            builder.UseFactory((serviceProvider) => {
                return(ServiceBusBuilder.Build(connectionString, topic, subscription, options, serviceProvider));
            });
            return(builder);
        }