示例#1
0
        /// <summary>
        /// Configure and create a bus for Azure Service Bus (later, we'll use Event Hubs instead)
        /// </summary>
        /// <param name="configure">The configuration callback to configure the bus</param>
        /// <returns></returns>
        public static IBusControl CreateUsingServiceBus(Action <IServiceBusBusFactoryConfigurator> configure)
        {
            var configurator = new ServiceBusBusFactoryConfigurator();

            configure(configurator);

            return(configurator.Build());
        }
        /// <summary>
        /// Configure and create a bus for Azure Service Bus (later, we'll use Event Hubs instead)
        /// </summary>
        /// <param name="configure">The configuration callback to configure the bus</param>
        /// <returns></returns>
        public static IBusControl CreateUsingServiceBus(Action <IServiceBusBusFactoryConfigurator> configure)
        {
            var configurator = new ServiceBusBusFactoryConfigurator(new ServiceBusEndpointConfiguration(new ServiceBusTopologyConfiguration(MessageTopology)));

            configure(configurator);

            return(configurator.Build());
        }
        /// <summary>
        /// Configure and create a bus for Azure Service Bus (later, we'll use Event Hubs instead)
        /// </summary>
        /// <param name="configure">The configuration callback to configure the bus</param>
        /// <returns></returns>
        public static IBusControl CreateUsingServiceBus(Action<IServiceBusBusFactoryConfigurator> configure)
        {
            var configurator = new ServiceBusBusFactoryConfigurator();

            configure(configurator);

            return configurator.Build();
        }
示例#4
0
        /// <summary>
        /// Configure and create a bus for Azure Service Bus (later, we'll use Event Hubs instead)
        /// </summary>
        /// <param name="configure">The configuration callback to configure the bus</param>
        /// <returns></returns>
        public static IBusControl CreateUsingServiceBus(Action <IServiceBusBusFactoryConfigurator> configure)
        {
            var topologyConfiguration = new ServiceBusTopologyConfiguration(MessageTopology);
            var busConfiguration      = new ServiceBusBusConfiguration(topologyConfiguration);

            var configurator = new ServiceBusBusFactoryConfigurator(busConfiguration);

            configure(configurator);

            return(configurator.Build(busConfiguration));
        }
示例#5
0
        static void AddBus(this IRegistrationConfigurator <IServiceProvider> configurator, Action <IServiceBusBusFactoryConfigurator> configure = null)
        {
            configurator.AddBus(context =>
            {
                IOptions <ServiceBusOptions> options = context.Container.GetRequiredService <IOptions <ServiceBusOptions> >();

                options.Value.MessageHandlerOptions.AutoComplete = true;

                IServiceBusBusConfiguration busConfiguration = context.Container.GetRequiredService <IServiceBusBusConfiguration>();

                var busFactoryConfigurator = new ServiceBusBusFactoryConfigurator(busConfiguration);

                busFactoryConfigurator.Host(options.Value.ConnectionString);
                busFactoryConfigurator.UseServiceBusMessageScheduler();

                configure?.Invoke(busFactoryConfigurator);

                return(busFactoryConfigurator.Build());
            });
        }