spring-boot icon indicating copy to clipboard operation
spring-boot copied to clipboard

Auto configuration for Kafka Cluster ID via application.properties

Open hemantmaersk opened this issue 2 years ago • 5 comments

Starting with version 3.1, the KafkaAdmin has this new API setClusterId which should be used to prevent attempting to fetch the cluster id from the broker, perhaps if the user does not have admin permissions.

Can we please have application property as spring.kafka.consumer.cluster-id and spring.kafka.producer.cluster-id to facilitate auto configuration of cluster id when user has ready only access or don't have admin access.

It is important to note that cluster id is needed to enabled Micrometer Observability without which it is not working.

Following is the Method with Java Docs of setClusterId method of KafkaAdmin class present in Spring Kafka with version 3.1, the has this new API:

/**
 * Set the cluster id. Use this to prevent attempting to fetch the cluster id
 * from the broker, perhaps if the user does not have admin permissions.
 * @param clusterId the clusterId to set
 * @since 3.1
 */
public void setClusterId(String clusterId) {

hemantmaersk avatar Dec 15 '23 09:12 hemantmaersk

I am facing a similar challenge. This would be a nice addition.

ashishqcs avatar Dec 18 '23 06:12 ashishqcs

Same issue for me. This renders Spring auto-configuration not really useful, if you have to overwrite the bean definition.

Would be great to have this. Thanks!

RickLatrine avatar Dec 22 '23 12:12 RickLatrine

I think this some overlap between this and #38830. We should figure out what, if anything, we're going to do for #38830 before adding more admin/cluster related properties.

wilkinsona avatar Jan 15 '24 07:01 wilkinsona

We have the same problem. The previous suggestion or having at least a way to override the KafkaRecordSenderContext and KafkaRecordReceiverContext would be a nice addition.

afasousa avatar Mar 06 '24 20:03 afasousa

facing similar issue - "could not find cluster info" after enabling observability. What is the fix for this?

himanshu1316 avatar Jun 27 '24 07:06 himanshu1316