Similar to: Changing spring-cloud-stream instance index/count at runtime
I do a poc on the launch of batch in a microserver architecture and I am using Spring batch with Spring Cloud Stream Kafka. I am looking for a way to dynamically create multiple instances of consumer (processor) application. I saw that it is possible to define a number of instances with
spring.cloud.stream.instanceCount=n
spring.cloud.stream.instanceIndex=[0, ..., n-1]
However I haven't found a way to dynamically change the value of instanceIndex. Is it possible to modify this value dynamically with Spring Cloud Stream kafka.
Thanks for any help.
I have find a solution how change dynamically the instanceindex automatically. I set the value of minPortNum & maxPortNum and instanceCount in the properties file and I vary instanceIndex depending on the value of port-minPortNum, and then I run as much consumer as I want.
for this example I have set spring.cloud.stream.instanceCount=3, so I run three consumer with instance index as value 0, 1 & 2