public void ExchangeBind(
            RabbitMQExchangeDeclaration declaration,
            RabbitMQExchangeBindingDeclaration binding)
        {
            var routingKey = binding.RoutingKey ?? declaration.Name;

            lock (@lock)
            {
                if (binding.NoWait)
                {
                    channel.ExchangeBindNoWait(
                        destination: declaration.Name,
                        source: binding.ExchangeDeclaration.Name,
                        routingKey: routingKey,
                        arguments: binding.Arguments);
                }
                else
                {
                    channel.ExchangeBind(
                        destination: declaration.Name,
                        source: binding.ExchangeDeclaration.Name,
                        routingKey: routingKey,
                        arguments: binding.Arguments);
                }
            }
        }
Esempio n. 2
0
        private static TBuilder BoundTo <TBuilder>(
            this TBuilder builder,
            IRabbitMQExchangeBuilderCore exchange,
            Action <IRabbitMQExchangeBindingBuilder> binding)
            where TBuilder : IRabbitMQExchangeBuilderCore
        {
            if (exchange is null)
            {
                throw new ArgumentNullException(nameof(exchange));
            }

            var declaration = new RabbitMQExchangeBindingDeclaration(exchange.ExchangeDeclaration);

            binding?.Invoke(new RabbitMQExchangeBindingBuilder(declaration));

            builder.ExchangeDeclaration.BindingDeclarations.Add(declaration);

            return(builder);
        }