-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
cannot auto discovery microservice #3914
Comments
The following code work ok ! just add sleep |
Do you have @EnableScheduling Annotation on your Admin Server? This is required for searching new services. |
yes, There is no difference |
the problem is 'discoveryClient.getInstances(id)' cannot read the latest data from consul |
You need to add some more details to help us understand the context of your messages. First you wrote, that some code snippet is working. Where is is working? Where did you add this? Where did you execute the code? Then you added another snippet (that is part of the first one) and say it does not work. This contradicts your first message. Also here: what do you mean with "cannot read"? Is there some network issue? Does cosul not have the data? Is the response not readable? Does Consul not provide the correct data? Do you get some error message in the logs? In your initial message you said "Not every time", so does it mean it is working somthimes? Maybe you just hav to wait a bit longer or decrease some interval? In what circumstances does it work? Can you provide some sample project showing your problem? |
InstanceDiscoveryListener.discover can be call when service register, above is the code to register to bootAdmin , line 126 can get the service but line 128 can not get instances if your add a custom @eventlistener to deal HeartbeatEvent like |
|
I have tried to reproduce the issue, too, without any luck. As soon as the servies appear in consule UI, the state is reflected in Spring Boot Admin. Please check if the services are registered at consul, do they appear in the UI at the registration side? As my colleague said, we need a project to reproduce the issue in order to help you. |
|
There is no other code left |
#3556 Maybe it's also with me |
To me this sounds like Consul does not provide the instances on time.
In your code the @scheduled annotation is still missing. |
because it enables a scheduler which checks the discovery server on a regular basis |
What is the purpose of adding '@EnabledScheduling'? |
env:
spring boot admin: 3.4.1
consul: v1.16.2(one node)
step 1: start spring-boot-admin
step 2: start other microservice
result : Not every time a newly launched service can be discovered
reason: method discoveryClient.getInstances can not read latest data
The text was updated successfully, but these errors were encountered: