private static QueueBinding BuildBinding(string bindingName, DeclareQueueBindingAttribute b, IConfiguration config, string routingKey = null)
        {
            var binding = new QueueBinding(bindingName);

            if (!string.IsNullOrEmpty(b.QueueName))
            {
                var reference = PropertyPlaceholderHelper.ResolvePlaceholders(b.QueueName, config);
                if (ConfigUtils.IsExpression(reference))
                {
                    reference = ConfigUtils.ExtractExpressionString(reference);
                    if (ConfigUtils.IsServiceReference(reference))
                    {
                        reference = ConfigUtils.ExtractServiceName(reference);
                    }
                }

                if (_queueDeclss.TryGetValue(reference, out var queueRef))
                {
                    reference = queueRef.QueueName;
                }

                binding.Destination = reference;
            }

            if (!string.IsNullOrEmpty(b.ExchangeName))
            {
                binding.Exchange = PropertyPlaceholderHelper.ResolvePlaceholders(b.ExchangeName, config);
            }
            else
            {
                binding.Exchange = string.Empty;
            }

            if (!string.IsNullOrEmpty(b.IgnoreDeclarationExceptions))
            {
                binding.IgnoreDeclarationExceptions = GetBoolean(b.IgnoreDeclarationExceptions, config, nameof(b.IgnoreDeclarationExceptions));
            }

            if (!string.IsNullOrEmpty(b.Declare))
            {
                binding.ShouldDeclare = GetBoolean(b.Declare, config, nameof(b.Declare));
            }

            if (!string.IsNullOrEmpty(routingKey))
            {
                binding.RoutingKey = PropertyPlaceholderHelper.ResolvePlaceholders(routingKey, config);
            }
            else
            {
                binding.RoutingKey = string.Empty;
            }

            if (b.Admins.Length > 0)
            {
                foreach (var a in b.Admins)
                {
                    binding.DeclaringAdmins.Add(a);
                }
            }

            return(binding);
        }