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

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

commit a6ab0005931947046f9ec65d86159a6cea57b2ab
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Feb 9 11:31:16 2026 +0100

    CAMEL-22971: camel-rest is optional
---
 .../platform/http/vertx/VertxPlatformHttpConsumer.java    | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git 
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
 
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
index d552bad55f78..2efe82d100ee 100644
--- 
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
+++ 
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
@@ -54,6 +54,7 @@ import 
org.apache.camel.component.platform.http.cookie.CookieHandler;
 import org.apache.camel.component.platform.http.spi.Method;
 import org.apache.camel.component.platform.http.spi.PlatformHttpConsumer;
 import org.apache.camel.spi.HeaderFilterStrategy;
+import org.apache.camel.spi.RestRegistry;
 import org.apache.camel.support.DefaultConsumer;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.MimeTypeHelper;
@@ -81,6 +82,7 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer
     private final String fileNameExtWhitelist;
     private final boolean muteExceptions;
     private final boolean handleWriteResponseError;
+    private RestRegistry restRegistry;
     private final List<Route> routes = new ArrayList<>();
     private Set<Method> methods;
     private String path;
@@ -111,6 +113,13 @@ public class VertxPlatformHttpConsumer extends 
DefaultConsumer
     @Override
     protected void doInit() throws Exception {
         super.doInit();
+
+        try {
+            restRegistry = getEndpoint().getCamelContext().getRestRegistry();
+        } catch (IllegalArgumentException e) {
+            // ignore as this is optional
+        }
+
         methods = Method.parseList(getEndpoint().getHttpMethodRestrict());
         path = configureEndpointPath(getEndpoint());  // in vertx-web we 
should replace path parameters from {xxx} to :xxx syntax
         router = 
VertxPlatformHttpRouter.lookup(getEndpoint().getCamelContext(), routerName);
@@ -137,7 +146,7 @@ public class VertxPlatformHttpConsumer extends 
DefaultConsumer
     protected void doStart() throws Exception {
         super.doStart();
 
-        if (startRestServicesContractFirst()) {
+        if (restRegistry != null && startRestServicesContractFirst()) {
             // rest-dsl contract first using multiple routers per api endpoint
             return;
         }
@@ -191,7 +200,7 @@ public class VertxPlatformHttpConsumer extends 
DefaultConsumer
      */
     protected boolean startRestServicesContractFirst() throws Exception {
         boolean matched = false;
-        for (var r : 
getEndpoint().getCamelContext().getRestRegistry().listAllRestServices()) {
+        for (var r : restRegistry.listAllRestServices()) {
             // rest-dsl contract-first we need to create a new unique router 
per API endpoint
             String target = path;
             if (target.endsWith("*")) {
@@ -227,7 +236,7 @@ public class VertxPlatformHttpConsumer extends 
DefaultConsumer
                 this.routes.add(sr);
             }
         }
-        for (var r : 
getEndpoint().getCamelContext().getRestRegistry().listAllRestSpecifications()) {
+        for (var r : restRegistry.listAllRestSpecifications()) {
             // rest-dsl contract-first we need to see if there is an api spec
             // that should be exposed via a vertx http router
             String target = path;

Reply via email to