I'm working on a reactive spring boot 3.1.6 project (spring-cloud-dependencies 2022.0.4) and I would like to have a consumer that can be toggled between batch enabled/disabled. Currently I have the following consumer setup:
@Component
public class MyMessageHandler implements Consumer<Flux<List<InputMessage>>> {
@Override
public void accept(Flux<List<InputMessage>> messages) {
// do stuff
}
}
and then the following application properties
spring.cloud.function.definition=myMessageHandler
spring.cloud.stream.function.bindings.myMessageHandler-in-0=my-messages-in
spring.cloud.stream.bindings.my-messages-in.destination=Some.Topic.Definition
#i want to be able to disable batch mode here
spring.cloud.stream.bindings.my-messages-in.consumer.batch-mode=true
As far as I know I cannot simply disable it in the configuration but still keep the Consumer definition as is. Is there a way to achieve this ?