Exemplo n.º 1
0
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            RabbitHutch.RegisterBus(
                new WindsorAdapter(container),
                c =>
            {
                var connectionString = container.Resolve <IOptions <EasyNetQConfig> >().Value.ConnectionString;
                return(c.Resolve <IConnectionStringParser>().Parse(connectionString));
            },
                s => { });

            container.Register(
                Component.For <IConfigureOptions <EasyNetQConfig> >().ImplementedBy <ConfigurationBinder <EasyNetQConfig> >().LifestyleSingleton(),
                Component.For <ITypeNameSerializer>().ImplementedBy <ShortNameTypeNameSerializer>().IsDefault().LifestyleSingleton(),
                Component.For <IRpc>().ImplementedBy <TransactionalRpc>().IsDefault().LifestyleSingleton(),
                Component.For <ILogProvider>().ImplementedBy <LoggerAdapterLogProvider>().LifestyleSingleton(),
                Component.For <IAppInitializer>().ImplementedBy <EasyNetQAppInitializer>().LifestyleSingleton(),
                Component.For <IEasyNetQMessageHandlerDispatcher>().ImplementedBy <EasyNetQMessageHandlerDispatcher>().LifestyleSingleton(),
                Component.For <IMessageConsumerInitializerFactory>().AsFactory().LifestyleSingleton(),
                Component.For(typeof(CommandConsumerInitializer <,>)).LifestyleSingleton(),
                Component.For(typeof(EventConsumerInitializer <,>)).LifestyleSingleton(),
                Component.For(typeof(RequestConsumerInitializer <,>)).LifestyleSingleton());
            container.RegisterInputMessageChannel <EasyNetQConsumerInitializerVisitor, EasyNetQInputConfig>();
            container.RegisterOutputMessageChannel <EasyNetQOutputMessageChannel, EasyNetQOutputConfig>();
        }
Exemplo n.º 2
0
        public static Container RegisterEasyNetQ(this Container container, Func <IServiceResolver, ConnectionConfiguration> connectionConfigurationFactory, Action <IServiceRegister> registerServices)
        {
            if (container == null)
            {
                throw new ArgumentNullException(nameof(container));
            }

            var serviceRegister = new SimpleInjectorAdapter(container);

            RabbitHutch.RegisterBus(serviceRegister, connectionConfigurationFactory, registerServices);
            return(container);
        }
Exemplo n.º 3
0
        public static IServiceCollection RegisterEasyNetQ(this IServiceCollection serviceCollection, Func <IServiceResolver, ConnectionConfiguration> connectionConfigurationFactory, Action <IServiceRegister> registerServices)
        {
            if (serviceCollection == null)
            {
                throw new ArgumentNullException(nameof(serviceCollection));
            }

            var serviceRegister = new ServiceCollectionAdapter(serviceCollection);

            RabbitHutch.RegisterBus(serviceRegister, connectionConfigurationFactory, registerServices);
            return(serviceCollection);
        }
        public static IKernel RegisterEasyNetQ(this IKernel kernel, Func <IServiceResolver, ConnectionConfiguration> connectionConfigurationFactory, Action <IServiceRegister> registerServices)
        {
            if (kernel == null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            var serviceRegister = new NinjectAdapter(kernel);

            RabbitHutch.RegisterBus(serviceRegister, connectionConfigurationFactory, registerServices);
            return(kernel);
        }
Exemplo n.º 5
0
        public static IRegistry RegisterEasyNetQ(this IRegistry registry, Func <IServiceResolver, ConnectionConfiguration> connectionConfigurationFactory, Action <IServiceRegister> registerServices)
        {
            if (registry == null)
            {
                throw new ArgumentNullException(nameof(registry));
            }

            var serviceRegister = new StructureMapAdapter(registry);

            RabbitHutch.RegisterBus(serviceRegister, connectionConfigurationFactory, registerServices);
            return(registry);
        }