英文:
Spring cloud stream: As a producer with requiredGroups defined can i specify a routingKey for the queue that will be created?
问题
我在文档中找不到关于我的问题的任何信息。如果有的话,而我漏掉了,请指出给我。
我有一个使用Spring Cloud Stream的RabbitMQ消息生产者服务,我的配置如下:
spring:
cloud:
stream:
bindings:
outputSink-out-0:
destination: foo
producer:
requiredGroups: bar
上述配置在RabbitMQ中创建了名为foo
的交换机以及一个带有路由键#
的bar
队列。我的问题是,如何配置bar
队列的特定路由键,例如test.#
?
英文:
I could not find anything in the documentation regarding my issue. If it is there and I missed it, please point it out to me.
I have a RabbitMQ message producer service using Spring Cloud Stream, and my configuration is as follows:
spring:
cloud:
stream:
bindings:
outputSink-out-0:
destination: foo
producer:
requiredGroups: bar
The above configuration creates my foo
exchange in RabbitMQ and a bar
queue with a routing key of #
. My question is, how can I configure a specific routing key, such as test.#
, for the bar
queue?
答案1
得分: 1
请查看文档:https://docs.spring.io/spring-cloud-stream/docs/current/reference/html/spring-cloud-stream-binder-rabbit.html#rabbit-prod-props
spring.cloud.stream.rabbit.bindings.outputSink-out-0.producer.binding-routing-key=...
>bindingRoutingKey
>用于将队列与交换机绑定的路由键(如果bindQueue为true)。可以是多个键 - 请参见bindingRoutingKeyDelimiter。对于分区目标,将-n附加到每个键。仅在提供了requiredGroups时才适用,而且仅适用于这些组。
>默认值:#。
英文:
See the documentation: https://docs.spring.io/spring-cloud-stream/docs/current/reference/html/spring-cloud-stream-binder-rabbit.html#rabbit-prod-props
spring.cloud.stream.rabbit.bindings.outputSink-out-0.producer.binding-routing-key=...
>bindingRoutingKey
>The routing key with which to bind the queue to the exchange (if bindQueue is true). Can be multiple keys - see bindingRoutingKeyDelimiter. For partitioned destinations, -n is appended to each key. Only applies if requiredGroups are provided and then only to those groups.
>Default: #.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论