/// <summary>
        /// Creates an event consumer.
        /// </summary>
        /// <param name="consumerElement">The consumer configuration.</param>
        /// <returns></returns>
        public IEventConsumer CreateConsumer(XElement consumerElement)
        {
            var connectionFactory = new ConnectionFactory();
            connectionFactory.Address = consumerElement.RequiredAttribute("address");

            // optional attributes
            consumerElement.OnOptionalAttribute(
                "username", value => connectionFactory.UserName = value);
            consumerElement.OnOptionalAttribute(
                "password", value => connectionFactory.Password = value);
            consumerElement.OnOptionalAttribute(
                "ssl", value => connectionFactory.Ssl = EnumHelper.Parse<SslOption>(value));

            // configuration for the queue
            var consumer = new RabbitMqEventConsumer(
                connectionFactory,
                consumerElement.OptionalAttribute("exchange"),
                consumerElement.RequiredAttribute("queue"));

            return consumer;
        }
        /// <summary>
        /// Creates an event consumer.
        /// </summary>
        /// <param name="consumerElement">The consumer configuration.</param>
        /// <returns></returns>
        public IEventConsumer CreateConsumer(XElement consumerElement)
        {
            var connectionFactory = new ConnectionFactory();

            connectionFactory.Address = consumerElement.RequiredAttribute("address");

            // optional attributes
            consumerElement.OnOptionalAttribute(
                "username", value => connectionFactory.UserName = value);
            consumerElement.OnOptionalAttribute(
                "password", value => connectionFactory.Password = value);
            consumerElement.OnOptionalAttribute(
                "ssl", value => connectionFactory.Ssl = EnumHelper.Parse <SslOption>(value));

            // configuration for the queue
            var consumer = new RabbitMqEventConsumer(
                connectionFactory,
                consumerElement.OptionalAttribute("exchange"),
                consumerElement.RequiredAttribute("queue"));

            return(consumer);
        }