List of usage examples for com.rabbitmq.client Channel queueBind
Queue.BindOk queueBind(String queue, String exchange, String routingKey, Map<String, Object> arguments)
throws IOException;
From source file:com.streamsets.pipeline.lib.rabbitmq.common.RabbitUtil.java
License:Apache License
private static void bindQueue(Channel channel, BaseRabbitConfigBean conf, RabbitExchangeConfigBean exchange) throws IOException { // If an exchange is specified, we need the routing key and then we bind it to the channel. // Note that routing key is ignored for Fanout and Headers (unsupported) type exchanges. String bindingKey = exchange.routingKey.isEmpty() ? conf.queue.name : exchange.routingKey; channel.queueBind(conf.queue.name, exchange.name, bindingKey, exchange.bindingProperties); }
From source file:org.mule.transport.amqp.harness.rules.AmqpModelRule.java
License:Open Source License
protected void applyBindingsConfiguration(Configuration configuration, Channel channel) throws IOException { List<Binding> configurationBindings = configuration.getBindings(); for (Binding binding : configurationBindings) { if (binding.getDestinationType().equalsIgnoreCase("queue")) { channel.queueBind(binding.getDestination(), binding.getSource(), binding.getRoutingKey(), new HashMap<String, Object>()); } else if (binding.getDestinationType().equalsIgnoreCase("exchange")) { channel.exchangeBind(binding.getDestination(), binding.getSource(), binding.getRoutingKey(), new HashMap<String, Object>()); }/*from w ww .j a v a 2s . c o m*/ } }
From source file:org.springframework.amqp.rabbit.core.RabbitAdmin.java
License:Apache License
private void declareBindings(final Channel channel, final Binding... bindings) throws IOException { for (Binding binding : bindings) { if (logger.isDebugEnabled()) { logger.debug("Binding destination [" + binding.getDestination() + " (" + binding.getDestinationType() + ")] to exchange [" + binding.getExchange() + "] with routing key [" + binding.getRoutingKey() + "]"); }// ww w .j a va 2 s . c om try { if (binding.isDestinationQueue()) { if (!isDeclaringImplicitQueueBinding(binding)) { channel.queueBind(binding.getDestination(), binding.getExchange(), binding.getRoutingKey(), binding.getArguments()); } } else { channel.exchangeBind(binding.getDestination(), binding.getExchange(), binding.getRoutingKey(), binding.getArguments()); } } catch (IOException e) { if (this.ignoreDeclarationExceptions) { if (logger.isWarnEnabled()) { logger.warn("Failed to declare binding:" + binding + ", continuing...", e); } } else { throw e; } } } }