Example #1
0
        public void BindTo(IExchange exchange, params string[] routingKeys)
        {
            if(exchange == null)
            {
                throw new ArgumentNullException("exchange");
            }
            if (routingKeys.Any(string.IsNullOrEmpty))
            {
                throw new ArgumentException("RoutingKey is null or empty");
            }
            if (routingKeys.Length == 0)
            {
                throw new ArgumentException("There must be at least one routingKey");
            }

            var binding = new Binding(this, exchange, routingKeys);
            bindings.Add(binding);
        }
Example #2
0
        public void BindTo(IExchange exchange, params string[] routingKeys)
        {
            if(exchange == null)
            {
                throw new ArgumentNullException("exchange");
            }
            if (exchange is DefaultExchange)
            {
                throw new EasyNetQException("All queues are bound automatically to the default exchange, do bind manually.");
            }
            if (routingKeys.Any(string.IsNullOrEmpty))
            {
                throw new ArgumentException("RoutingKey is null or empty");
            }
            if (routingKeys.Length == 0)
            {
                throw new ArgumentException("There must be at least one routingKey");
            }

            var binding = new Binding(this, exchange, routingKeys);
            bindings.Add(binding);
        }
Example #3
0
        public virtual void BindTo(IExchange exchange, params string[] routingKeys)
        {
            Preconditions.CheckNotNull(exchange, "exchange");
            Preconditions.CheckAny(routingKeys, "routingKeys", "There must be at least one routingKey");
            Preconditions.CheckFalse(routingKeys.Any(string.IsNullOrEmpty), "routingKeys", "RoutingKey is null or empty");

            var binding = new Binding(this, exchange, routingKeys);
            bindings.Add(binding);
        }
Example #4
0
        public void BindTo(IExchange exchange, params string[] routingKeys)
        {
            Preconditions.CheckNotNull(exchange, "exchange");
            Preconditions.CheckAny(routingKeys, "routingKeys", "There must be at least one routingKey");
            Preconditions.CheckFalse(routingKeys.Any(string.IsNullOrEmpty), "routingKeys", "RoutingKey is null or empty");

            if (exchange is DefaultExchange)
            {
                throw new EasyNetQException("All queues are bound automatically to the default exchange, do bind manually.");
            }

            var binding = new Binding(this, exchange, routingKeys);
            bindings.Add(binding);
        }