/// <summary>
        /// Add Azure Queue Storage as the underlying transport for the Event Bus.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="configure"></param>
        /// <returns></returns>
        public static EventBusBuilder AddAzureQueueStorageTransport(this EventBusBuilder builder, Action <AzureQueueStorageTransportOptions> configure)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (configure is null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            var services = builder.Services;

            // configure the options for Azure Queue Storage
            services.Configure(configure);
            services.AddSingleton <IPostConfigureOptions <AzureQueueStorageTransportOptions>, AzureQueueStoragePostConfigureOptions>();

            // register the transport
            builder.AddTransport <AzureQueueStorageTransport, AzureQueueStorageTransportOptions>();

            return(builder);
        }
Exemple #2
0
        /// <summary>
        /// Add InMemory as the underlying transport for the Event Bus.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="configure"></param>
        /// <returns></returns>
        public static EventBusBuilder AddInMemoryTransport(this EventBusBuilder builder,
                                                           Action <InMemoryTransportOptions> configure = null)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var services = builder.Services;

            // configure the options for InMemory transport
            if (configure != null)
            {
                services.Configure(configure);
            }

            services.AddSingleton <SequenceNumberGenerator>();

            // register the transport
            builder.AddTransport <InMemoryTransport, InMemoryTransportOptions>();

            return(builder);
        }