繁体   English   中英

Spring Cloud Stream Rabbit Binder 为所有消费者共享并发

[英]Spring Cloud Stream Rabbit Binder shared concurrency for all consumers

我正在尝试使用 Spring Cloud Stream RabbitMQ 活页夹集成我的应用程序。 我有 2 个应用程序。 生产者和消费者。 在消费者应用程序中有 2 个输入通道,读取不同的消息负载类型。 我知道我们可以为输入通道定义并发设置。 但是在我的消费者应用程序中,所有输入通道都应该共享相同的并发性。 我的意思是并发设置应该由所有输入通道共享。 我找不到任何方法来实现这一点。

这是我在消费者应用程序中的设置。 我知道我可以通过以下方式定义不同的并发数。 但在我的情况下,对于模拟 1 和模拟 2 通道,并发数总共应为 5(机器的核心数)

    spring:
  autoconfigure:
    exclude: org.springframework.boot.actuate.autoconfigure.metrics.jdbc.DataSourcePoolMetricsAutoConfiguration
  application:
    name: simulator
  cloud:
    stream:
      function:
          definition: simulate1;simulate2
      rabbit:
        type: rabbit
        environment:
          spring:
            rabbitmq:
              host: localhost
              port: 5672
              username: guest
              password: guest
      kafka:
        binder:
          replicationFactor: 2
          auto-create-topics: true
          brokers: localhost:9092, localhost:9093, localhost:9094
          consumer-properties:
            key.deserializer: org.apache.kafka.common.serialization.StringDeserializer
            value.deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
            spring:
              json:
                trusted:
                  packages: '*'
          configuration:
            value.deserializer: org.springframework.kafka.support.serializer.ErrorHandlingDeserializer
            key.deserializer: org.springframework.kafka.support.serializer.ErrorHandlingDeserializer
      bindings:
        simulate1-in-0:
          destination: pf-topic
          content-type: application/json
          group: service
          binder: rabbit
          consumer:
            use-native-decoding: true
            concurrency: 5
        simulate2-in-0:
              destination: pf-topic
              content-type: application/json
              group: service
              binder: rabbit
              consumer:
                use-native-decoding: true
                concurrency: 5

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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