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 withversion 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) {
Comment From: ashishqcs
I am facing a similar challenge. This would be a nice addition.
Comment From: RickLatrine
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!
Comment From: wilkinsona
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.
Comment From: afasousa
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.
Comment From: himanshu1316
facing similar issue - "could not find cluster info" after enabling observability. What is the fix for this?