简体   繁体   中英

When I use spring-cloud-stream to send rabbitmq messages, I cannot specify the RoutingKey sent

I use the 3.1.3 version. After the following configuration,'output-out-0.producer.bindingRoutingKey' does not take effect. When I send a message, Routing keys = command_exchange_open instead of: 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

The producer property should be routing-key-expression: '''ORDER_PUSH''' not bindingRoutingKey .

          output-out-0:
            producer:
              bindingRoutingKey: ORDER_PUSH
              queueNameGroupOnly: true
              bindQueue: false

These properties do not apply to producers (unless you have required-groups set).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM