binding.setAdminsThatShouldDeclare(rabbitAdmin);
@Override public Binding getObject() { String destination; DestinationType destinationType; if (this.destinationQueue != null) { destination = this.destinationQueue.getName(); destinationType = DestinationType.QUEUE; } else { destination = this.destinationExchange.getName(); destinationType = DestinationType.EXCHANGE; } Binding binding = new Binding(destination, destinationType, this.exchange, this.routingKey, this.arguments); if (this.shouldDeclare != null) { binding.setShouldDeclare(this.shouldDeclare); } if (this.ignoreDeclarationExceptions != null) { binding.setIgnoreDeclarationExceptions(this.ignoreDeclarationExceptions); } if (this.adminsThatShouldDeclare != null) { binding.setAdminsThatShouldDeclare((Object[]) this.adminsThatShouldDeclare); } return binding; }
@Bean public Binding binding() throws IOException { Binding binding = new Binding("foo", DestinationType.QUEUE, exchange().getName(), "foo", null); binding.setAdminsThatShouldDeclare(admin1()); return binding; } }
@Override public Binding getObject() { String destination; DestinationType destinationType; if (this.destinationQueue != null) { destination = this.destinationQueue.getName(); destinationType = DestinationType.QUEUE; } else { destination = this.destinationExchange.getName(); destinationType = DestinationType.EXCHANGE; } Binding binding = new Binding(destination, destinationType, this.exchange, this.routingKey, this.arguments); if (this.shouldDeclare != null) { binding.setShouldDeclare(this.shouldDeclare); } if (this.ignoreDeclarationExceptions != null) { binding.setIgnoreDeclarationExceptions(this.ignoreDeclarationExceptions); } if (this.adminsThatShouldDeclare != null) { binding.setAdminsThatShouldDeclare((Object[]) this.adminsThatShouldDeclare); } return binding; }
context.getBeanFactory().registerSingleton("bar", exchange); Binding binding = new Binding("foo", DestinationType.QUEUE, "bar", "foo", null); binding.setAdminsThatShouldDeclare(admin); context.getBeanFactory().registerSingleton("baz", binding); context.refresh();
context.getBeanFactory().registerSingleton("bar", exchange); Binding binding = new Binding("foo", DestinationType.QUEUE, "bar", "foo", null); binding.setAdminsThatShouldDeclare(other); context.getBeanFactory().registerSingleton("baz", binding); context.refresh();
private void registerBindings(QueueBinding binding, String queueName, String exchangeName, String exchangeType) { final String[] routingKeys; if (exchangeType.equals(ExchangeTypes.FANOUT) || binding.key().length == 0) { routingKeys = new String[] { "" }; } else { final int length = binding.key().length; routingKeys = new String[length]; for (int i = 0; i < length; ++i) { routingKeys[i] = resolveExpressionAsString(binding.key()[i], "@QueueBinding.key"); } } final Map<String, Object> bindingArguments = resolveArguments(binding.arguments()); final boolean bindingIgnoreExceptions = resolveExpressionAsBoolean(binding.ignoreDeclarationExceptions()); boolean declare = resolveExpressionAsBoolean(binding.declare()); for (String routingKey : routingKeys) { final Binding actualBinding = new Binding(queueName, DestinationType.QUEUE, exchangeName, routingKey, bindingArguments); actualBinding.setIgnoreDeclarationExceptions(bindingIgnoreExceptions); actualBinding.setShouldDeclare(declare); if (binding.admins().length > 0) { actualBinding.setAdminsThatShouldDeclare((Object[]) binding.admins()); } ((ConfigurableBeanFactory) this.beanFactory) .registerSingleton(exchangeName + "." + queueName + ++this.increment, actualBinding); } }
private void registerBindings(QueueBinding binding, String queueName, String exchangeName, String exchangeType) { final String[] routingKeys; if (exchangeType.equals(ExchangeTypes.FANOUT) || binding.key().length == 0) { routingKeys = new String[] { "" }; } else { final int length = binding.key().length; routingKeys = new String[length]; for (int i = 0; i < length; ++i) { routingKeys[i] = resolveExpressionAsString(binding.key()[i], "@QueueBinding.key"); } } final Map<String, Object> bindingArguments = resolveArguments(binding.arguments()); final boolean bindingIgnoreExceptions = resolveExpressionAsBoolean(binding.ignoreDeclarationExceptions()); boolean declare = resolveExpressionAsBoolean(binding.declare()); for (String routingKey : routingKeys) { final Binding actualBinding = new Binding(queueName, DestinationType.QUEUE, exchangeName, routingKey, bindingArguments); actualBinding.setIgnoreDeclarationExceptions(bindingIgnoreExceptions); actualBinding.setShouldDeclare(declare); if (binding.admins().length > 0) { actualBinding.setAdminsThatShouldDeclare((Object[]) binding.admins()); } ((ConfigurableBeanFactory) this.beanFactory) .registerSingleton(exchangeName + "." + queueName + ++this.increment, actualBinding); } }