Esempio n. 1
0
        /// <summary>
        /// Registers a consumer given the lifetime scope specified
        /// </summary>
        /// <typeparam name="T">The consumer type</typeparam>
        /// <param name="configurator">The service bus configurator</param>
        /// <param name="context">The LifetimeScope of the container</param>
        /// <param name="configure"></param>
        /// <param name="name">The name of the scope created per-message</param>
        /// <returns></returns>
        public static void Consumer <T>(this IReceiveEndpointConfigurator configurator,
                                        IComponentContext context, Action <IConsumerConfigurator <T> > configure, string name = "message")
            where T : class, IConsumer
        {
            var consumerFactory = new AutofacConsumerFactory <T>(context.Resolve <ILifetimeScope>(), name);

            configurator.Consumer(consumerFactory, configure);
        }
Esempio n. 2
0
        /// <summary>
        /// Registers a consumer given the lifetime scope specified
        /// </summary>
        /// <typeparam name="T">The consumer type</typeparam>
        /// <param name="configurator">The service bus configurator</param>
        /// <param name="scope">The LifetimeScope of the container</param>
        /// <param name="name">The name of the scope created per-message</param>
        /// <returns></returns>
        public static void Consumer <T>(this IReceiveEndpointConfigurator configurator,
                                        ILifetimeScope scope, string name = "message")
            where T : class, IConsumer
        {
            var consumerFactory = new AutofacConsumerFactory <T>(scope, name);

            configurator.Consumer(consumerFactory);
        }
Esempio n. 3
0
        public static ConsumerSubscriptionConfigurator <TConsumer> Consumer <TConsumer>(
            this SubscriptionBusServiceConfigurator configurator, ILifetimeScope scope)
            where TConsumer : class, IConsumer
        {
            var consumerFactory = new AutofacConsumerFactory <TConsumer>(scope);

            return(configurator.Consumer(consumerFactory));
        }