protected override IEnumerable <string> GetQueryStringOptions()
        {
            foreach (var option in base.GetQueryStringOptions())
            {
                yield return(option);
            }

            if (_bindToQueue)
            {
                yield return("bind=true");
            }

            if (!string.IsNullOrWhiteSpace(_queueName))
            {
                yield return("queue=" + WebUtility.UrlEncode(_queueName));
            }

            if (ExchangeArguments != null && ExchangeArguments.TryGetValue("x-delayed-type", out var delayedType))
            {
                yield return("delayedType=" + delayedType);
            }

            foreach (var binding in _exchangeBindings)
            {
                yield return($"bindexchange={binding.ExchangeName}");
            }
        }
示例#2
0
 public void SetExchangeArgument(string key, object value)
 {
     if (!ExchangeArguments.ContainsKey(key))
     {
         ExchangeArguments.Add(key, value);
     }
 }
示例#3
0
 public void SetExchangeArgument(string key, object value)
 {
     if (value != null)
     {
         ExchangeArguments[key] = value;
     }
     else
     {
         ExchangeArguments.Remove(key);
     }
 }
示例#4
0
 public override string ToString()
 {
     return(string.Join(", ", new[]
     {
         $"name: {ExchangeName}",
         $"type: {ExchangeType}",
         Durable ? "durable" : "",
         AutoDelete ? "auto-delete" : "",
         string.Join(", ", ExchangeArguments.Select(x => $"{x.Key}: {x.Value}"))
     }.Where(x => !string.IsNullOrWhiteSpace(x))));
 }
        public void SetExchangeArgument(string key, object value)
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (value == null)
            {
                ExchangeArguments.Remove(key);
            }
            else
            {
                ExchangeArguments[key] = value;
            }
        }
 public Uri GetSendAddress(Uri hostAddress)
 {
     return(new RabbitMqEndpointAddress(hostAddress, ExchangeName, ExchangeType, Durable, AutoDelete, _bindToQueue, _queueName,
                                        ExchangeArguments.ContainsKey("x-delayed-type") ? (string)ExchangeArguments["x-delayed-type"] : default,