You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/12/08 13:59:35 UTC

[camel] 04/04: CAMEL-17301: camel-jbang - Show list of known http endpoints - also when reloading if they are changed.

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 740822950226d7351cc21dbebd5024a28526e9a8
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Dec 8 14:58:00 2021 +0100

     CAMEL-17301: camel-jbang - Show list of known http endpoints - also when reloading if they are changed.
---
 .../src/main/java/org/apache/camel/main/VertxHttpServer.java     | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/VertxHttpServer.java b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/VertxHttpServer.java
index a1607ab..8279b78 100644
--- a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/VertxHttpServer.java
+++ b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/VertxHttpServer.java
@@ -91,6 +91,15 @@ public final class VertxHttpServer {
                     method = ReflectionHelper.findMethod(phc.getClass(), "getHttpEndpoints");
                 }
 
+                // when reloading then there may be more routes in the same batch, so we only want
+                // to log the summary at the end
+                if (event instanceof CamelEvent.RouteReloadedEvent) {
+                    CamelEvent.RouteReloadedEvent re = (CamelEvent.RouteReloadedEvent) event;
+                    if (re.getIndex() < re.getTotal()) {
+                        return;
+                    }
+                }
+
                 Set<String> endpoints = (Set<String>) ObjectHelper.invokeMethodSafe(method, phc);
                 if (endpoints.isEmpty()) {
                     return;