We have integrated spring-boot-admin
into many projects. Now, due to some tricky network reasons, I am unable to access the built-in UI interface of SBA. Therefore, I would like to periodically retrieve the equivalent information from its interface programmatically and write it to the database, so that I can read and present it from another program.
The simplest way seems to be to curl
the application interface, but considering the timing logic and SBA are in the same program, I want to minimize unnecessary network calls. After some preliminary research, I wrote the following code(in Kotlin):
//Autowired
private val registry: ApplicationRegistry
fun refreshAppRegistry() {
//I want get it synchronously, so Flux etc is not needed
val applications = registry.applications.collectList().block()?.filterNotNull().orEmpty()
//Handle data, the way I retrieve fields just like:
appName = app.name,
serviceUrl = it.registration.serviceUrl.orEmpty(),
managementUrl = it.registration.managementUrl,
buildVersion = it.buildVersion?.value,
instanceStatus = it.statusInfo.status,
}
However, I found that the information I retrieved seems to be somewhat delayed: changes in the actuator/info information (such as build.version) of the monitored application are NOT reflected in my program. I have to restart the admin program to get the latest information. Please advise me on what went wrong, thank you!