Search code examples
apache-kafka-streamsspring-cloud-streamspring-cloud-stream-binder-kafka

Only auto-create producer topics using spring cloud stream kafka streams binder


Is it possible to enable spring.cloud.stream.kafka.streams.binder.auto-create-topics in the application.yml only for topics that the application produces and not auto-create topics that the application consumes? I'd like for my producers to only be responsible for creating topics. I'm using spring-cloud-streams with the kafka-streams binder.

In a more general sense, is this the right approach to creating kafka topics?


Solution

  • It is a binder, not a binding, property so, no.

    You can, however, use the multi-binder support and define 2 kafka binders with that property set as needed, one for producer and the other for consumer bindings.

    https://docs.spring.io/spring-cloud-stream/docs/3.0.10.RELEASE/reference/html/spring-cloud-stream.html#multiple-binders

    I suggest you open a new feature suggestion in a GitHub issue against the binder, allowing the binder property to be overridden at the binding level.

    https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues