我有一个Spring Cloud Stream应用程序,使用RabbitMQ Binders 来消息消息(它不会产生任何消息) . application.yaml 文件如下所示:
spring:
cloud:
stream:
rabbit:
bindings:
x:
consumer:
bindingRoutingKey: x.z.#
queueNameGroupOnly: true
y:
consumer:
bindingRoutingKey: y.z.#
queueNameGroupOnly: true
bindings:
x:
binder: rabbit
group: q1
destination: x
y:
binder: rabbit
group: q2
destination: y
这将在RabbitMQ中创建两个队列:
q1 必须与路由键 x.z.# 交换 x
q2 必须与路由键 y.z.# 交换 y
我想创建一个消耗多个交换和路由密钥的单个队列 . 我知道我无法将交换从 application.yaml 绑定到多个路由密钥(请参阅this SO问题),因此我怀疑我无法将Spring Cloud Stream配置为使用多个目标(交换)进行单个绑定 .
所以我的问题是,我可以以编程方式声明,以便一个 binding 从多个交换消耗?如果这样做,是否需要在 application.yaml 文件中保留任何内容?
我该怎么办?