0

I am trying to integrate my application using Spring Cloud Stream RabbitMQ binder. I have 2 applications. Producer, And Consumer. In Consumer application there are 2 input channels, reading different Message Payload Types. I know that we can define concurrency settings for input channel. But in my Consumer application, all input channels should share same concurrency. I mean concurrency settings should be shared by all input channels. I could not find any way to accomplish this.

This is my setting in consumer application. I know that I can define different concurrency numbers by following. But in my case, Number of concurrency should be 5 (core number of machine) at total for both simulate1 and simulate2 channel

    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
user725455
  • 465
  • 10
  • 36

1 Answers1

0

See the documentation https://docs.spring.io/spring-cloud-stream/docs/current/reference/html/spring-cloud-stream.html#binding-properties

spring.cloud.stream.default.consumer.concurrency=5
Gary Russell
  • 166,535
  • 14
  • 146
  • 179