org.springframework.amqp.core.Binding.setShouldDeclare()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(199)

本文整理了Java中org.springframework.amqp.core.Binding.setShouldDeclare()方法的一些代码示例,展示了Binding.setShouldDeclare()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Binding.setShouldDeclare()方法的具体详情如下:
包路径:org.springframework.amqp.core.Binding
类名称:Binding
方法名:setShouldDeclare

Binding.setShouldDeclare介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-amqp

@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;
}

代码示例来源:origin: org.springframework.amqp/spring-rabbit

@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;
}

代码示例来源:origin: spring-projects/spring-amqp

context.getBeanFactory().registerSingleton("bar", exchange);
Binding binding = new Binding("foo", DestinationType.QUEUE, "bar", "foo", null);
binding.setShouldDeclare(false);
context.getBeanFactory().registerSingleton("baz", binding);
context.refresh();

代码示例来源:origin: spring-projects/spring-amqp

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);
  }
}

代码示例来源:origin: org.springframework.amqp/spring-rabbit

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);
  }
}

相关文章