Spring Cloud Stream Batch Consumer and Batch Producer

kirthi
kirthi Member Posts: 22 ✭✭

Batch mode is true and batch size is 10. Still when we run the application with volumes of data, the batch size grows upto 75.

Any suggestions on the below properties?

Properties:

spring.cloud.stream.bindings.receiveMessage-in-0.consumer.batch-mode=true

spring.cloud.stream.bindings.receiveMessage-in-0.consumer.use-native-decoding=true

spring.cloud.stream.bindings.receiveMessage-in-0.consumer.batchMaxSize= 10

spring.cloud.stream.bindings.receiveMessage-in-0.consumer.batchTimeout= 5000

spring.cloud.stream.bindings.receiveMessage-in-0.consumer.concurrency = 10

spring.cloud.stream.bindings.receiveMessage-in-0.consumer.max-attempts = 3

spring.cloud.stream.bindings.receiveMessage-in-0.consumer.back-off-initial-interval = 2000

spring.cloud.stream.bindings.receiveMessage-in-0.consumer.back-off-max-interval = 30000

spring.cloud.stream.bindings.receiveMessage-in-0.consumer.back-off-multiplier = 2

spring.cloud.stream.bindings.receiveMessage-in-0.consumer.default-retryable = true

Answers

  • nicholasdgoodman
    nicholasdgoodman Member, Employee Posts: 43 Solace Employee

    Hello,

    I am not completely sure why this is the case, but on my setup I can control the batch size by using the following settings:

    spring.cloud.stream.solace.bindings.receiveMessage-in-0.consumer.batch-max-size=10
    

    Can you give that a try and see if it helps?

  • giri
    giri Member, Administrator, Employee Posts: 115 admin

    Hi @kirthi

    Can you try setting the batch properties on the binder?

    spring.cloud.stream.solace.bindings.receiveMessage-in-0.consumer.batchMaxSize= 10

    spring.cloud.stream.solace.bindings.receiveMessage-in-0.consumer.batchTimeout= 5000