使用spring-cloud-stream发送rabbitmq消息时无法指定发送的RoutingKey
When I use spring-cloud-stream to send rabbitmq messages, I cannot specify the RoutingKey sent
我用的是3.1.3版本。以下配置后,'output-out-0.producer.bindingRoutingKey'不生效。当我发送消息时,路由键 = command_exchange_open 而不是:ORDER_PUSH
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>
spring:
rabbitmq:
addresses: amqp://sycx:sycx@192.168.1.204
cloud:
stream:
rabbit:
bindings:
input-in-0:
consumer:
bindingRoutingKey: ORDER_PUSH
exchangeType: direct
queueNameGroupOnly: true
output-out-0:
producer:
bindingRoutingKey: ORDER_PUSH
queueNameGroupOnly: true
bindQueue: false
bindings:
input-in-0:
destination: command_exchange_open
group: ORDER_END
output-out-0:
destination: command_exchange_open
group: ORDER_END
function:
definition: input;output
生产者 属性 应该是 routing-key-expression: '''ORDER_PUSH'''
而不是 bindingRoutingKey
。
output-out-0:
producer:
bindingRoutingKey: ORDER_PUSH
queueNameGroupOnly: true
bindQueue: false
这些属性不适用于生产者(除非您设置了 required-groups
)。
我用的是3.1.3版本。以下配置后,'output-out-0.producer.bindingRoutingKey'不生效。当我发送消息时,路由键 = command_exchange_open 而不是:ORDER_PUSH
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>
spring:
rabbitmq:
addresses: amqp://sycx:sycx@192.168.1.204
cloud:
stream:
rabbit:
bindings:
input-in-0:
consumer:
bindingRoutingKey: ORDER_PUSH
exchangeType: direct
queueNameGroupOnly: true
output-out-0:
producer:
bindingRoutingKey: ORDER_PUSH
queueNameGroupOnly: true
bindQueue: false
bindings:
input-in-0:
destination: command_exchange_open
group: ORDER_END
output-out-0:
destination: command_exchange_open
group: ORDER_END
function:
definition: input;output
生产者 属性 应该是 routing-key-expression: '''ORDER_PUSH'''
而不是 bindingRoutingKey
。
output-out-0:
producer:
bindingRoutingKey: ORDER_PUSH
queueNameGroupOnly: true
bindQueue: false
这些属性不适用于生产者(除非您设置了 required-groups
)。