Example usage for com.rabbitmq.client Channel queueUnbind

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

Introduction

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

Prototype

Queue.UnbindOk queueUnbind(String queue, String exchange, String routingKey, Map<String, Object> arguments)
        throws IOException;

Source Link

Document

Unbind a queue 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>());
        }//  ww w .j  a  va2 s.  co  m
    }
}

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

License:Apache License

@Override
@ManagedOperation/* w w w  .  j  a  va 2  s  .c om*/
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;
        }
    });
}