Spring Cloud Stream Batch Consumer and Batch Producer

Options
kirthi
kirthi Member Posts: 18

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: 33 Solace Employee
    Options

    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: 104 admin
    Options

    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