Example usage for com.rabbitmq.client Channel exchangeUnbind

List of usage examples for com.rabbitmq.client Channel exchangeUnbind

Introduction

In this page you can find the example usage for com.rabbitmq.client Channel exchangeUnbind.

Prototype

Exchange.UnbindOk exchangeUnbind(String destination, String source, String routingKey,
        Map<String, Object> arguments) throws IOException;

Source Link

Document

Unbind an exchange from an exchange.

Usage

From source file:org.mule.transport.amqp.harness.rules.AmqpModelRule.java

License:Open Source License

protected void undoBindingsConfiguration(Configuration configuration, Channel channel) throws IOException {
    List<Binding> configurationBindings = configuration.getBindings();

    for (Binding binding : configurationBindings) {
        if (binding.getDestinationType().equalsIgnoreCase("queue")) {
            channel.queueUnbind(binding.getDestination(), binding.getSource(), binding.getRoutingKey(),
                    new HashMap<String, Object>());

        } else if (binding.getDestinationType().equalsIgnoreCase("exchange")) {
            channel.exchangeUnbind(binding.getDestination(), binding.getSource(), binding.getRoutingKey(),
                    new HashMap<String, Object>());
        }//  w w w  .java  2  s .c  o m
    }
}

From source file:org.springframework.amqp.rabbit.core.RabbitAdmin.java

License:Apache License

@Override
@ManagedOperation//  w  w w .j  av a2  s  . com
public void removeBinding(final Binding binding) {
    rabbitTemplate.execute(new ChannelCallback<Object>() {
        @Override
        public Object doInRabbit(Channel channel) throws Exception {
            if (binding.isDestinationQueue()) {
                if (isRemovingImplicitQueueBinding(binding)) {
                    return null;
                }

                channel.queueUnbind(binding.getDestination(), binding.getExchange(), binding.getRoutingKey(),
                        binding.getArguments());
            } else {
                channel.exchangeUnbind(binding.getDestination(), binding.getExchange(), binding.getRoutingKey(),
                        binding.getArguments());
            }
            return null;
        }
    });
}