private List <RabbitMQValidatorSettings> GetRabbitMQVasaURIsAndSections(List <ConfigSection> configValues)
        {
            var infos = new List <RabbitMQValidatorSettings>();

            var validatorConfigSection = configValues.FirstOrDefault();

            if (validatorConfigSection != null)
            {
                var messagingSections = validatorConfigSection.Values.Where(s => s.Name == VasaInstanceItemName);

                log.Debug("RabbitMQValidatorProxy GetRabbitMQVasaURIsAndSections: found {RabbitValidatorCount} rabbitmq instances", messagingSections.Count());

                foreach (var section in messagingSections)
                {
                    string[] splitSection = section.Value.Split(new char[] { ',' });

                    if (splitSection.Length != 2)
                    {
                        log.Debug("RabbitMQValidatorProxy GetRabbitMQVasaURIsAndSections: VasaURI {VasaValue}", section.Value);

                        throw new Exception(string.Format("Vasa section {0} was incorrectly formatted! Expected format is 'VasaURI, SectionName'", section.Value));
                    }

                    var mvi = new RabbitMQValidatorSettings(splitSection[0].Trim(), splitSection[1].Trim());
                    infos.Add(mvi);

                    log.Debug("RabbitMQValidatorProxy GetRabbitMQVasaURIsAndSections: VasaURI {VasaURI} and SectionName: {SectionName}", mvi.VasaURI, mvi.SectionName);
                }
            }

            return(infos);
        }
        public IValidator Create(IValidatorInstance validatorInstance)
        {
            Guard.NotNull(validatorInstance, "validatorInstance", log);

            log.Info("RabbitMQValidatorProxy create validator instance for {Name}", validatorInstance.Name);

            if (this._validatorInstances == null)
            {
                throw new Exception(string.Format("ValidatorInstance Dictionary was null - GetAvailableValidators not called: {0}", validatorInstance.Name));
            }

            RabbitMQValidatorSettings settings = (RabbitMQValidatorSettings)this._validatorInstances[validatorInstance];

            if (settings == null)
            {
                throw new Exception(string.Format("RabbitMQ Validator Instance not found: {0}", validatorInstance.Name));
            }

            return(this._childKernel.Get <RabbitMQErrorValidator>(new ConstructorArgument(RabbitMQErrorValidator.RabbitMQValidatorSettingsParamName, settings)));
        }
Exemplo n.º 3
0
 public RabbitMQErrorValidator(RabbitMQValidatorSettings rabbitMQValidatorSettings) :
     base(RabbitMQValidatorProxy.RabbitMQValidatorId)
 {
     this._rabbitMQValidatorSettings = Guard.NotNull(rabbitMQValidatorSettings, "rabbitMQValidatorSettings", log);
     this.AddTags();
 }