/// <summary> /// Parse the supplied XmlElement and populate the supplied ObjectDefinitionBuilder as required. /// </summary> /// <remarks> /// The default implementation delegates to the /// <code> /// DoParse /// </code> /// version without /// ParameterContext argument. /// </remarks> /// <param name="element">The element.</param><param name="parserContext">The parser context.</param><param name="builder">The builder used to define the /// <code> /// IObjectDefinition /// </code> /// .</param> protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder) { const string messageQueuePropName = nameof(RedisChannel.MessageQueue); const string deadLetterQueuePropName = nameof(RedisChannel.DeadLetterQueue); const string poisonQueuePropName = nameof(RedisChannel.PoisonQueue); const string msgConverterPropName = nameof(RedisChannel.MessageConverter); const string errorHandlerPropName = nameof(RedisChannel.DefaultErrorHandler); var parentId = ResolveId(element, builder.ObjectDefinition, parserContext); if (!element.IsPropertyDefined(errorHandlerPropName)) { var deadLetterErrHandlerObject = new RootObjectDefinition(typeof(DeadLetterErrorHandler)); deadLetterErrHandlerObject.PropertyValues.Add(nameof(DeadLetterErrorHandler.Channel), new RuntimeObjectReference(parentId)); builder.AddPropertyValue(errorHandlerPropName, deadLetterErrHandlerObject); } else { NamespaceUtils.SetPropertyIfAttributeOrElementDefined(element, parserContext, builder, errorHandlerPropName); } NamespaceUtils.CheckPresenceRule(element, parserContext, ListenerElementName); NamespaceUtils.CheckPresenceRule(element, parserContext, messageQueuePropName); NamespaceUtils.CheckPresenceRule(element, parserContext, msgConverterPropName); NamespaceUtils.CheckAmbiguityRule(element, parserContext, messageQueuePropName); NamespaceUtils.CheckAmbiguityRule(element, parserContext, deadLetterQueuePropName); NamespaceUtils.CheckAmbiguityRule(element, parserContext, poisonQueuePropName); NamespaceUtils.CheckAmbiguityRule(element, parserContext, msgConverterPropName); NamespaceUtils.CheckAmbiguityRule(element, parserContext, errorHandlerPropName); NamespaceUtils.SetPropertyIfAttributeOrElementDefined(element, parserContext, builder, messageQueuePropName); NamespaceUtils.SetPropertyIfAttributeOrElementDefined(element, parserContext, builder, deadLetterQueuePropName); NamespaceUtils.SetPropertyIfAttributeOrElementDefined(element, parserContext, builder, poisonQueuePropName); NamespaceUtils.SetPropertyIfAttributeOrElementDefined(element, parserContext, builder, msgConverterPropName); NamespaceUtils.SetValueIfAttributeDefined(builder, element, nameof(RedisChannel.Concurrency)); NamespaceUtils.SetCollectionPropertyIfElementDefined(element, parserContext, builder, nameof(RedisChannel.Listeners), nameof(RedisListener.Channel), parentId); NamespaceUtils.SetCollectionPropertyIfElementDefined(element, parserContext, builder, nameof(RedisChannel.AdviceChain)); }
/// <summary> /// Parse the supplied XmlElement and populate the supplied ObjectDefinitionBuilder as required. /// </summary> /// <remarks> /// The default implementation delegates to the /// <code> /// DoParse /// </code> /// version without /// ParameterContext argument. /// </remarks> /// <param name="element">The element.</param><param name="parserContext">The parser context.</param><param name="builder">The builder used to define the /// <code> /// IObjectDefinition /// </code> /// .</param> protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder) { NamespaceUtils.AddConstructorArgRefIfAttributeDefined(builder, element, nameof(RedisQueueSentinel.Connection).ToCamelCase()); NamespaceUtils.AddConstructorArgValueIfAttributeDefined(builder, element, nameof(RedisQueueSentinel.MessageTimeout).ToCamelCase()); NamespaceUtils.AddConstructorArgValueIfAttributeDefined(builder, element, nameof(RedisQueueSentinel.Interval).ToCamelCase()); }
/// <summary> /// Parse the supplied XmlElement and populate the supplied ObjectDefinitionBuilder as required. /// </summary> /// <remarks> /// The default implementation delegates to the /// <code> /// DoParse /// </code> /// version without /// ParameterContext argument. /// </remarks> /// <param name="element">The element.</param><param name="parserContext">The parser context.</param><param name="builder">The builder used to define the /// <code> /// IObjectDefinition /// </code> /// .</param> protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder) { NamespaceUtils.AddConstructorArgValue(builder, element, nameof(RedisQueue.Name).ToCamelCase()); NamespaceUtils.AddConstructorArgValue(builder, element, nameof(RedisQueue.TTL).ToLowerInvariant()); }