rabbitmq - 更改 RabbitMQ 绑定
问题描述
我有一个应用程序充当发布者并定期将消息发送到交换和其他十几个(订阅者),这些应用程序在语义上被主题摸索。我的问题是订阅者可以在不同的组之间移动,因此他们的主题订阅应该改变,但我不知道如何动态改变绑定。有任何想法吗?
我对每个订阅者的配置如下所示:
@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);
}
}
PS:一定不能重启我的Subscriber SpringBoot应用,不然就很明显了。
解决方案
您不能更改绑定;但是,您可以添加和删除它们。
您可以使用管理 UI 手动执行此操作,也可以使用RabbitAdmin
.
推荐阅读
- python - 将 excel 文件读入具有管道和空格作为分隔符的 pandas DF
- python-3.x - 适用于 Outlook 的 Python win32com.client:“移动”功能将有限数量的电子邮件从收件箱移动到其他文件夹
- python - CMake 错误:找不到 Python(缺少:Python_NumPy_INCLUDE_DIRS NumPy)(找到版本“2.7.17”)
- erlang - erlang 跟踪器中的堆栈跟踪
- c++ - 如果使用同一个锁进入不同的临界区会发生什么
- jquery - 在加载期间,iframe 内容在 JavaScript 中不可用
- python - UndefinedError:模板中未定义“请求”
- python - 通过将列中的 NaN 值替换为另一列中的非 NaN 值来更新 Pandas 数据框
- javascript - JS for循环在for循环中,我猜范围有问题
- python - 烧瓶-SQLAlchemy。如何查询数据库?