【问题标题】:Change RabbitMQ bindings更改 RabbitMQ 绑定
【发布时间】:2019-05-16 21:08:17
【问题描述】:

我有一个应用程序充当发布者并定期将消息发送到交换器和其他十几个按主题在语义上摸索的应用程序(订阅者)。我的问题是订阅者可以在不同的组之间移动,因此他们的主题订阅应该改变,但我不知道如何动态改变绑定。有什么想法吗?

每个订阅者的配置如下所示:

@Bean
TopicExchange exchange() {
    return new TopicExchange(exchangeName);
}

@Bean
Binding binding(Queue queue, TopicExchange exchange) {
    return BindingBuilder.bind(queue).to(exchange).with(routingKey);
}

@Bean
Queue queue(SystemInformationService systemInformationService) {
    return new Queue(systemInformationService.getInfo().getTemplateName() != null ?  systemInformationService.getInfo().getTemplateName() : queueName , true);
}

}

P.S:我的Subscriber SpringBoot应用一定不能重启,否则很明显。

【问题讨论】:

    标签: rabbitmq spring-rabbit


    【解决方案1】:

    您不能更改绑定;但是,您可以添加和删除它们。

    您可以使用管理 UI 手动执行此操作,也可以使用 RabbitAdmin

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-16
      • 1970-01-01
      相关资源
      最近更新 更多