/// <summary>The do parse.</summary>
        /// <param name="element">The element.</param>
        /// <param name="parserContext">The parser context.</param>
        /// <param name="builder">The builder.</param>
        protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder)
        {
            var connectionFactoryRef = element.GetAttribute(CONNECTION_FACTORY_ATTRIBUTE);

            if (string.IsNullOrWhiteSpace(connectionFactoryRef))
            {
                parserContext.ReaderContext.ReportFatalException(element, "A '" + CONNECTION_FACTORY_ATTRIBUTE + "' attribute must be set.");
            }

            if (!string.IsNullOrWhiteSpace(connectionFactoryRef))
            {
                // Use constructor with connectionFactory parameter
                builder.AddConstructorArgReference(connectionFactoryRef);
            }

            NamespaceUtils.SetValueIfAttributeDefined(builder, element, CHANNEL_TRANSACTED_ATTRIBUTE);
            NamespaceUtils.SetValueIfAttributeDefined(builder, element, QUEUE_ATTRIBUTE);
            NamespaceUtils.SetValueIfAttributeDefined(builder, element, EXCHANGE_ATTRIBUTE);
            NamespaceUtils.SetValueIfAttributeDefined(builder, element, ROUTING_KEY_ATTRIBUTE);
            NamespaceUtils.SetValueIfAttributeDefined(builder, element, REPLY_TIMEOUT_ATTRIBUTE);
            NamespaceUtils.SetValueIfAttributeDefined(builder, element, ENCODING_ATTRIBUTE);
            NamespaceUtils.SetReferenceIfAttributeDefined(builder, element, MESSAGE_CONVERTER_ATTRIBUTE);
            NamespaceUtils.SetReferenceIfAttributeDefined(builder, element, REPLY_QUEUE_ATTRIBUTE);
            NamespaceUtils.SetValueIfAttributeDefined(builder, element, MANDATORY_ATTRIBUTE);
            NamespaceUtils.SetValueIfAttributeDefined(builder, element, IMMEDIATE_ATTRIBUTE);
            NamespaceUtils.SetReferenceIfAttributeDefined(builder, element, RETURN_CALLBACK_ATTRIBUTE);
            NamespaceUtils.SetReferenceIfAttributeDefined(builder, element, CONFIRM_CALLBACK_ATTRIBUTE);

            IObjectDefinition replyContainer = null;
            XmlElement childElement = null;
            var childElements = element.SelectChildElementsByTagName(LISTENER_ELEMENT);
            if (childElements.Count > 0)
            {
                childElement = childElements[0] as XmlElement;
            }

            if (childElement != null)
            {
                replyContainer = this.ParseListener(childElement, element, parserContext);
                if (replyContainer != null)
                {
                    replyContainer.PropertyValues.Add("MessageListener", new RuntimeObjectReference(element.GetAttribute(ID_ATTRIBUTE)));
                    var replyContainerName = element.GetAttribute(ID_ATTRIBUTE) + ".ReplyListener";
                    parserContext.Registry.RegisterObjectDefinition(replyContainerName, replyContainer);
                }
            }

            if (replyContainer == null && element.HasAttribute(REPLY_QUEUE_ATTRIBUTE))
            {
                parserContext.ReaderContext.ReportFatalException(element, "For template '" + element.GetAttribute(ID_ATTRIBUTE) + "', when specifying a reply-queue, a <reply-listener/> element is required");
            }
            else if (replyContainer != null && !element.HasAttribute(REPLY_QUEUE_ATTRIBUTE))
            {
                parserContext.ReaderContext.ReportFatalException(element, "For template '" + element.GetAttribute(ID_ATTRIBUTE) + "', a <reply-listener/> element is not allowed if no 'reply-queue' is supplied");
            }
        }
 /// <summary>The do parse bindings.</summary>
 /// <param name="parserContext">The parser context.</param>
 /// <param name="exchangeName">The exchange name.</param>
 /// <param name="bindings">The bindings.</param>
 /// <param name="parser">The parser.</param>
 protected void DoParseBindings(ParserContext parserContext, string exchangeName, XmlElement bindings, AbstractExchangeParser parser)
 {
     if (bindings != null)
     {
         foreach (var binding in bindings.SelectChildElementsByTagName(BINDING_ELE))
         {
             var objectDefinition = parser.ParseBinding(exchangeName, binding as XmlElement, parserContext);
             this.RegisterObjectDefinition(new ObjectDefinitionHolder(objectDefinition, parserContext.ReaderContext.GenerateObjectName(objectDefinition)), parserContext.Registry);
         }
     }
 }