@KafkaListener
has nothing to do with Spring Cloud Stream; it is in the Spring for Apache Kafka project (which Spring Cloud Stream uses for its Kafka binder).
See the javadocs
/**
* The unique identifier of the container managing for this endpoint.
* <p>If none is specified an auto-generated one is provided.
* <p>Note: When provided, this value will override the group id property
* in the consumer factory configuration, unless {@link #idIsGroup()}
* is set to false.
* <p>SpEL {@code #{...}} and property place holders {@code ${...}} are supported.
* @return the {@code id} for the container managing for this endpoint.
* @see org.springframework.kafka.config.KafkaListenerEndpointRegistry#getListenerContainer(String)
*/
String id() default "";
The id
is also used to get the listener container from the KafkaListenerEndpointRegistry
bean so you can stop()
and start()
it.
If you want to use spring-cloud-stream instead; read its documentation.