public OpenQueueProcessorArraySubResolver(IKernel kernel, QueueConfigSectionHandler queueConfig)
        {
            this.kernel = kernel;
            var messageTypes = new List <Type>(queueConfig.QueueProcessors.Count);

            messageTypes.AddRange(
                from QueueProcessorElement processor in queueConfig.QueueProcessors
                select queueConfig.MessageTypes[queueConfig.MessageQueues[processor.MessageQueue].MessageType].Type);
            queueProcessorTypes = messageTypes;
        }
        public static void RegisterConfiguredMessageLogicHandlers(
            QueueConfigSectionHandler config,
            IWindsorContainer container)
        {
            var registrations = new List <IRegistration>();

            foreach (MessageLogicHandlerElement handler in config.MessageLogicHandlers)
            {
                var interfaceType =
                    typeof(IMessageProcessingLogic <>).MakeGenericType(config.MessageTypes[handler.MessageType].Type);
                registrations.Add(Component.For(interfaceType).ImplementedBy(handler.Type));
                registrations.Add(Component.For(typeof(IGenericFactory <>).MakeGenericType(interfaceType)).AsFactory());
            }

            container.Register(registrations.ToArray());
        }
        public static void RegisterConfiguredQueueProcessors(
            QueueConfigSectionHandler queueConfig,
            IWindsorContainer container)
        {
            var registrations = new List <IRegistration>();

            foreach (QueueProcessorElement config in queueConfig.QueueProcessors)
            {
                var parameters = new Dictionary <string, object> {
                    { "messageProcessingMode", config.MessageProcessingMode }, { "numWorkers", config.NumWorkers }
                };
                var queueType =
                    queueConfig.MessageTypes[queueConfig.MessageQueues[config.MessageQueue].MessageType].Type;
                registrations.AddRange(QueueProcessorAutoRegister.RegisterQueueProcessorAndNode(queueType, parameters));
            }

            container.Register(registrations.ToArray());
        }
        public static void RegisterConfiguredQueues(QueueConfigSectionHandler config, IWindsorContainer container)
        {
            var registrations              = new List <IRegistration>();
            var untypedReadQueueInterface  = typeof(IReadQueue <>);
            var untypedWriteQueueInterface = typeof(IWriteQueue <>);
            var untypedReadQueue           = typeof(ReadQueue <>);
            var untypedWriteQueue          = typeof(WriteQueue <>);

            foreach (MessageQueueElement queueConfig in config.MessageQueues)
            {
                var parameters = new Dictionary <string, object>
                {
                    { "messageQueueHostServerName", queueConfig.MessageQueueHostServerName },
                    { "auditActivity", queueConfig.AuditActivity },
                    { "defaultRecoverable", queueConfig.DefaultRecoverable },
                    { "isTransactional", queueConfig.IsTransactional },
                    { "multicastAddress", queueConfig.MulticastAddress },
                    { "queueName", queueConfig.Name }
                };

                var messageType = config.MessageTypes[queueConfig.MessageType].Type;

                if (queueConfig.Mode.Contains("R"))
                {
                    registrations.Add(
                        Component.For(untypedReadQueueInterface.MakeGenericType(messageType))
                        .ImplementedBy(untypedReadQueue.MakeGenericType(messageType))
                        .DependsOn(parameters));
                }

                if (queueConfig.Mode.Contains("W"))
                {
                    registrations.Add(
                        Component.For(untypedWriteQueueInterface.MakeGenericType(messageType))
                        .ImplementedBy(untypedWriteQueue.MakeGenericType(messageType))
                        .DependsOn(parameters));
                }

                registrations.Add(Component.For(typeof(IReadQueueFactory <>).MakeGenericType(messageType)).AsFactory());
                registrations.Add(Component.For(typeof(IWriteQueueFactory <>).MakeGenericType(messageType)).AsFactory());
            }

            container.Register(registrations.ToArray());
        }