List of usage examples for com.rabbitmq.client Channel exchangeBind
Exchange.BindOk exchangeBind(String destination, String source, String routingKey,
Map<String, Object> arguments) throws IOException;
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 w w. j a va2 s .co 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() + "]"); }/*from w ww . j a va2 s . co m*/ 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; } } } }