From c63f037135ee3626a51f4f82a416945557a4cf26 Mon Sep 17 00:00:00 2001 From: Auri Munoz Date: Fri, 26 Jul 2024 11:47:32 +0200 Subject: [PATCH 1/3] Add a few logs for registrars --- .../serviceregistration/eureka/EurekaServiceRegistrar.java | 5 ++++- .../staticlist/StaticListServiceRegistrar.java | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/service-registration/eureka/src/main/java/io/smallrye/stork/serviceregistration/eureka/EurekaServiceRegistrar.java b/service-registration/eureka/src/main/java/io/smallrye/stork/serviceregistration/eureka/EurekaServiceRegistrar.java index bc55047d..fdae2b8a 100644 --- a/service-registration/eureka/src/main/java/io/smallrye/stork/serviceregistration/eureka/EurekaServiceRegistrar.java +++ b/service-registration/eureka/src/main/java/io/smallrye/stork/serviceregistration/eureka/EurekaServiceRegistrar.java @@ -76,11 +76,14 @@ private Uni registerApplicationInstance(WebClient client, String applicati .put("name", "MyOwn")) .put("leaseInfo", new JsonObject().put("renewalIntervalInSecs", 10000).put("durationInSecs", 10000)); - return client.post(path + "/eureka/apps/" + applicationId) + Uni response = client.post(path + "/eureka/apps/" + applicationId) .putHeader("content-type", "application/json") .putHeader("accept", "application/json") .sendJson(instance).replaceWithVoid(); + log.info("Instance registered for service {}: {}", applicationId, registration); + return response; + } } diff --git a/service-registration/static-list/src/main/java/io/smallrye/stork/serviceregistration/staticlist/StaticListServiceRegistrar.java b/service-registration/static-list/src/main/java/io/smallrye/stork/serviceregistration/staticlist/StaticListServiceRegistrar.java index bb3659dc..f9075a74 100644 --- a/service-registration/static-list/src/main/java/io/smallrye/stork/serviceregistration/staticlist/StaticListServiceRegistrar.java +++ b/service-registration/static-list/src/main/java/io/smallrye/stork/serviceregistration/staticlist/StaticListServiceRegistrar.java @@ -28,6 +28,7 @@ public Uni registerServiceInstance(String serviceName, Metadata Date: Fri, 26 Jul 2024 11:49:02 +0200 Subject: [PATCH 2/3] use {} --- .../staticlist/StaticListServiceRegistrar.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service-registration/static-list/src/main/java/io/smallrye/stork/serviceregistration/staticlist/StaticListServiceRegistrar.java b/service-registration/static-list/src/main/java/io/smallrye/stork/serviceregistration/staticlist/StaticListServiceRegistrar.java index f9075a74..03ea9cbd 100644 --- a/service-registration/static-list/src/main/java/io/smallrye/stork/serviceregistration/staticlist/StaticListServiceRegistrar.java +++ b/service-registration/static-list/src/main/java/io/smallrye/stork/serviceregistration/staticlist/StaticListServiceRegistrar.java @@ -28,7 +28,7 @@ public Uni registerServiceInstance(String serviceName, Metadata Date: Fri, 26 Jul 2024 12:00:24 +0200 Subject: [PATCH 3/3] add log in invoke because of asynchronous --- .../serviceregistration/eureka/EurekaServiceRegistrar.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/service-registration/eureka/src/main/java/io/smallrye/stork/serviceregistration/eureka/EurekaServiceRegistrar.java b/service-registration/eureka/src/main/java/io/smallrye/stork/serviceregistration/eureka/EurekaServiceRegistrar.java index fdae2b8a..66d1a729 100644 --- a/service-registration/eureka/src/main/java/io/smallrye/stork/serviceregistration/eureka/EurekaServiceRegistrar.java +++ b/service-registration/eureka/src/main/java/io/smallrye/stork/serviceregistration/eureka/EurekaServiceRegistrar.java @@ -79,9 +79,10 @@ private Uni registerApplicationInstance(WebClient client, String applicati Uni response = client.post(path + "/eureka/apps/" + applicationId) .putHeader("content-type", "application/json") .putHeader("accept", "application/json") - .sendJson(instance).replaceWithVoid(); + .sendJson(instance) + .invoke(() -> log.info("Instance registered for service {}: {}", applicationId, registration)) + .replaceWithVoid(); - log.info("Instance registered for service {}: {}", applicationId, registration); return response; }