3

Created Library which has one cloud stream consumer and cloud stream producer and this library injected in all the micro services as a dependency, this works fine for me.

I have requirement that some micro services doesn't need consumer. So looking for flexibility to disable/enable consumer based on some configured properties to use the same library.

sbogadhi
  • 31
  • 1
  • 3

1 Answers1

0

Set the autoStartup property to false.

https://docs.spring.io/spring-cloud-stream/docs/3.0.8.RELEASE/reference/html/spring-cloud-stream.html#_consumer_properties

You can use a property placeholder ${auto.start}.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • I was able to get it working (i.e. to disable the consumer) in Spring Boot service but only with following yaml config (focus on default). We tested this thoroughly with and without config and for sure, the consumer stopped consuming once the autoStartup has been set to false. spring: cloud: stream: default: consumer: autoStartup: false – Wim Van den Brande Jun 21 '22 at 18:32