-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set default clientId throws InstanceAlreadyExistsException #187
Comments
Why are you using an old release candidate? The current Greenwich version is SR6 https://spring.io/projects/spring-cloud#learn You can't set the client id that way. You can add a @Bean
public ListenerContainerCustomizer<AbstractKafkaListenerContainerFactory<?, ?>> customizer() {
return (container, destinationName, group) -> container.getContainerProperties().setClientIdPrefix(...); |
Hi Gary, Thank you, I updated the version to Greenwich SR6. I tried the below code and no-luck, still the clientid field is empty. I verified the bean method is invoked during the startup.
In my console, below are the properties I can see.
|
Sorry, I made a typo in the generic type; also you must set a unique prefix for each binding: @Bean
public ListenerContainerCustomizer<AbstractMessageListenerContainer<?, ?>> customizer() {
return (container, destinationName, group) -> container.getContainerProperties().setClientId(destinationName + "." + group);
} By the way, it is not good practice to put multiple input bindings in the same group - a rebalance on one consumer will force an unnecessary rebalance on the other(s). |
Hi Gary, still clientId is empty.
then I tried below code as well and I can see application started successfully and no trace of exception in console.
I'm using
|
I'm having the same issue here, I'm trying to setup a client-id in order to be able to have clear logs when we startup the app and one cluster isn't available. Currently the client-id of the adminclient beans are the generic ones, prefixes by
I would like to change the client id so it's clear which cluster is down. This log can be reproduced with only one cluster (you can use I can provide a minimal app if required (I'll work on it tomorrow). We can set the value using the Note that if the cluster is responding, the consumer client ids are setup from the |
Here is a project that can be used to show this specific case: https://github.com/mborgraeve/kafka-binder-client-id-sample |
I did not understand what you are saying here. What's the harm in giving the same groupId to different topics? Does it really cause rebalancing? Did I misunderstand? If so, can you explain why? When rebalancing, only the groupId is taken care of?@garyrussell Your Answer : (By the way, it is not good practice to put multiple input bindings in the same group - a rebalance on one consumer will force an unnecessary rebalance on the other(s).) |
Thank you @garyrussell . What you said worked. I was really able to customize client Ids. However, I have a small problem. I have 20 topics. I follow the logs. Different client Ids are assigned to the consumers of my 20 topics as I want. However, only 5 consumers have a problem afterwards. It prints the clientId log to them again and override the clientId that I assigned. New different clientIds are assigned for those 5 consumers. I don't understand why he behaved like this. I wonder if it takes my new clientId while doing rebalance. Why does this code work for some consumers and not others? Why is it suddenly assigned a different clientId? I'm doing something wrong but I don't know what. |
@PrabaharanK did u solve? |
Hi Team
I'm using Greenwich.RC2 spring cloud version for my project. I try to set client.id specification for the kafka binder and gets below exception.
How to set the client.id property?, I tried to set the property on bindings level but no impact, I shared my application.yml as well.
The text was updated successfully, but these errors were encountered: