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


The following commit(s) were added to refs/heads/main by this push:
     new bf616cd524c CAMEL-20557: Rest DSL to use openapi spec directly
bf616cd524c is described below

commit bf616cd524cbf483ac3349c12134f7a4cbd6e4c3
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Apr 4 20:27:33 2024 +0200

    CAMEL-20557: Rest DSL to use openapi spec directly
---
 .../http/vertx/VertxPlatformHttpConsumer.java      |  4 +++-
 .../http/vertx/VertxPlatformHttpEngine.java        |  4 ++--
 ...sumer.java => DefaultPlatformHttpConsumer.java} | 15 ++++++++------
 .../platform/http/PlatformHttpComponent.java       |  2 +-
 .../platform/http/PlatformHttpEndpoint.java        | 10 +++++-----
 ...rmHttpEngine.java => PlatformHttpConsumer.java} | 21 +++++---------------
 ...pEngine.java => PlatformHttpConsumerAware.java} | 23 ++++------------------
 .../platform/http/spi/PlatformHttpEngine.java      |  7 +++----
 .../http/JettyCustomPlatformHttpConsumer.java      |  5 ++---
 .../http/JettyCustomPlatformHttpEngine.java        |  4 ++--
 .../DefaultRestOpenapiProcessorStrategy.java       |  6 +++---
 .../rest/openapi/RestOpenApiEndpoint.java          |  9 +++++----
 .../rest/openapi/RestOpenApiProcessor.java         |  8 ++++----
 .../rest/openapi/RestOpenapiProcessorStrategy.java |  4 ++--
 .../ROOT/pages/camel-4x-upgrade-guide-4_6.adoc     |  5 +++++
 15 files changed, 55 insertions(+), 72 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 d7033a60af5..9a311acad86 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
@@ -51,6 +51,7 @@ import 
org.apache.camel.component.platform.http.PlatformHttpEndpoint;
 import org.apache.camel.component.platform.http.cookie.CookieConfiguration;
 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.support.DefaultConsumer;
 import org.apache.camel.util.FileUtil;
@@ -67,7 +68,8 @@ import static 
org.apache.camel.util.CollectionHelper.appendEntry;
  * A {@link org.apache.camel.Consumer} for the {@link 
org.apache.camel.component.platform.http.spi.PlatformHttpEngine}
  * based on Vert.x Web.
  */
-public class VertxPlatformHttpConsumer extends DefaultConsumer implements 
Suspendable, SuspendableService {
+public class VertxPlatformHttpConsumer extends DefaultConsumer
+        implements PlatformHttpConsumer, Suspendable, SuspendableService {
     private static final Logger LOGGER = 
LoggerFactory.getLogger(VertxPlatformHttpConsumer.class);
     private static final Pattern PATH_PARAMETER_PATTERN = 
Pattern.compile("\\{([^/}]+)\\}");
 
diff --git 
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpEngine.java
 
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpEngine.java
index 325cd4d6507..aeb30eb0763 100644
--- 
a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpEngine.java
+++ 
b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpEngine.java
@@ -24,10 +24,10 @@ import io.vertx.core.Handler;
 import io.vertx.ext.web.RoutingContext;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
-import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.component.platform.http.PlatformHttpConstants;
 import org.apache.camel.component.platform.http.PlatformHttpEndpoint;
+import org.apache.camel.component.platform.http.spi.PlatformHttpConsumer;
 import org.apache.camel.component.platform.http.spi.PlatformHttpEngine;
 import org.apache.camel.spi.annotations.JdkService;
 import org.apache.camel.support.CamelContextHelper;
@@ -78,7 +78,7 @@ public class VertxPlatformHttpEngine extends ServiceSupport 
implements PlatformH
     }
 
     @Override
-    public Consumer createConsumer(PlatformHttpEndpoint endpoint, Processor 
processor) {
+    public PlatformHttpConsumer createConsumer(PlatformHttpEndpoint endpoint, 
Processor processor) {
         return new VertxPlatformHttpConsumer(
                 endpoint,
                 processor,
diff --git 
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpConsumer.java
 
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/DefaultPlatformHttpConsumer.java
similarity index 82%
rename from 
components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpConsumer.java
rename to 
components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/DefaultPlatformHttpConsumer.java
index bfc357db814..d26c2505da7 100644
--- 
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpConsumer.java
+++ 
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/DefaultPlatformHttpConsumer.java
@@ -16,20 +16,22 @@
  */
 package org.apache.camel.component.platform.http;
 
-import org.apache.camel.Consumer;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Processor;
 import org.apache.camel.Suspendable;
 import org.apache.camel.SuspendableService;
+import org.apache.camel.component.platform.http.spi.PlatformHttpConsumer;
+import org.apache.camel.component.platform.http.spi.PlatformHttpConsumerAware;
 import org.apache.camel.support.DefaultConsumer;
 import org.apache.camel.support.service.ServiceHelper;
 
-public class PlatformHttpConsumer extends DefaultConsumer implements 
Suspendable, SuspendableService {
+public class DefaultPlatformHttpConsumer extends DefaultConsumer
+        implements PlatformHttpConsumerAware, Suspendable, SuspendableService {
 
-    private Consumer platformHttpConsumer;
+    private PlatformHttpConsumer platformHttpConsumer;
     private boolean register = true;
 
-    public PlatformHttpConsumer(Endpoint endpoint, Processor processor) {
+    public DefaultPlatformHttpConsumer(Endpoint endpoint, Processor processor) 
{
         super(endpoint, processor);
     }
 
@@ -50,7 +52,8 @@ public class PlatformHttpConsumer extends DefaultConsumer 
implements Suspendable
         this.register = register;
     }
 
-    public Consumer getDelegtePlatformHttpConsumer() {
+    @Override
+    public PlatformHttpConsumer getPlatformHttpConsumer() {
         return platformHttpConsumer;
     }
 
@@ -62,7 +65,7 @@ public class PlatformHttpConsumer extends DefaultConsumer 
implements Suspendable
         ServiceHelper.initService(platformHttpConsumer);
     }
 
-    protected void configurePlatformHttpConsumer(Consumer 
platformHttpConsumer) {
+    protected void configurePlatformHttpConsumer(PlatformHttpConsumer 
platformHttpConsumer) {
         // noop
     }
 
diff --git 
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java
 
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java
index 0ce0ee76dfb..05fbb6f5d55 100644
--- 
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java
+++ 
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java
@@ -248,7 +248,7 @@ public class PlatformHttpComponent extends 
HeaderFilterStrategyComponent
         endpoint.setProduces(produces);
 
         // configure consumer properties
-        PlatformHttpConsumer consumer = (PlatformHttpConsumer) 
endpoint.createConsumer(processor);
+        DefaultPlatformHttpConsumer consumer = 
endpoint.createConsumer(processor);
         consumer.setRegister(register);
         if (config.getConsumerProperties() != null && 
!config.getConsumerProperties().isEmpty()) {
             setProperties(camelContext, consumer, 
config.getConsumerProperties());
diff --git 
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
 
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
index dc940c1f73e..1e8e5065c8f 100644
--- 
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
+++ 
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
@@ -19,10 +19,10 @@ package org.apache.camel.component.platform.http;
 import org.apache.camel.AsyncEndpoint;
 import org.apache.camel.Category;
 import org.apache.camel.Component;
-import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.component.platform.http.cookie.CookieConfiguration;
+import org.apache.camel.component.platform.http.spi.PlatformHttpConsumer;
 import org.apache.camel.component.platform.http.spi.PlatformHttpEngine;
 import org.apache.camel.http.base.HttpHeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategy;
@@ -101,14 +101,14 @@ public class PlatformHttpEndpoint extends DefaultEndpoint 
implements AsyncEndpoi
     }
 
     @Override
-    public Consumer createConsumer(Processor processor) throws Exception {
-        Consumer consumer = new PlatformHttpConsumer(this, processor);
+    public DefaultPlatformHttpConsumer createConsumer(Processor processor) 
throws Exception {
+        DefaultPlatformHttpConsumer consumer = new 
DefaultPlatformHttpConsumer(this, processor);
         configureConsumer(consumer);
         return consumer;
     }
 
-    protected Consumer createPlatformHttpConsumer(Processor processor) throws 
Exception {
-        Consumer consumer = getOrCreateEngine().createConsumer(this, 
processor);
+    protected PlatformHttpConsumer createPlatformHttpConsumer(Processor 
processor) throws Exception {
+        PlatformHttpConsumer consumer = 
getOrCreateEngine().createConsumer(this, processor);
         configureConsumer(consumer);
         return consumer;
     }
diff --git 
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpEngine.java
 
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpConsumer.java
similarity index 58%
copy from 
components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpEngine.java
copy to 
components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpConsumer.java
index c5a6e52ceb5..fc8d7caa173 100644
--- 
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpEngine.java
+++ 
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpConsumer.java
@@ -17,28 +17,17 @@
 package org.apache.camel.component.platform.http.spi;
 
 import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
 import org.apache.camel.component.platform.http.PlatformHttpEndpoint;
 
 /**
- * An abstraction of an HTTP Server engine on which HTTP endpoints can be 
deployed.
+ * Consumer for the platform-http component.
  */
-public interface PlatformHttpEngine {
+public interface PlatformHttpConsumer extends Consumer {
 
     /**
-     * Creates a new {@link Consumer} for the given {@link 
PlatformHttpEndpoint}.
-     *
-     * @param  platformHttpEndpoint the {@link PlatformHttpEndpoint} to create 
a consumer for
-     * @param  processor            the Processor to pass to
-     * @return                      a new {@link Consumer}
+     * Gets the {@link PlatformHttpEndpoint} for the consumer.
      */
-    Consumer createConsumer(PlatformHttpEndpoint platformHttpEndpoint, 
Processor processor);
-
-    /**
-     * The port number the HTTP server is using, if possible to determine.
-     */
-    default int getServerPort() {
-        return 0;
-    }
+    @Override
+    PlatformHttpEndpoint getEndpoint();
 
 }
diff --git 
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpEngine.java
 
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpConsumerAware.java
similarity index 52%
copy from 
components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpEngine.java
copy to 
components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpConsumerAware.java
index c5a6e52ceb5..4f691aebfec 100644
--- 
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpEngine.java
+++ 
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpConsumerAware.java
@@ -16,29 +16,14 @@
  */
 package org.apache.camel.component.platform.http.spi;
 
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.component.platform.http.PlatformHttpEndpoint;
-
 /**
- * An abstraction of an HTTP Server engine on which HTTP endpoints can be 
deployed.
+ * An interface to represent an object that has been injected with {@link 
PlatformHttpConsumer}.
  */
-public interface PlatformHttpEngine {
-
-    /**
-     * Creates a new {@link Consumer} for the given {@link 
PlatformHttpEndpoint}.
-     *
-     * @param  platformHttpEndpoint the {@link PlatformHttpEndpoint} to create 
a consumer for
-     * @param  processor            the Processor to pass to
-     * @return                      a new {@link Consumer}
-     */
-    Consumer createConsumer(PlatformHttpEndpoint platformHttpEndpoint, 
Processor processor);
+public interface PlatformHttpConsumerAware {
 
     /**
-     * The port number the HTTP server is using, if possible to determine.
+     * Gets the {@link PlatformHttpConsumer}.
      */
-    default int getServerPort() {
-        return 0;
-    }
+    PlatformHttpConsumer getPlatformHttpConsumer();
 
 }
diff --git 
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpEngine.java
 
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpEngine.java
index c5a6e52ceb5..4cf549289d4 100644
--- 
a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpEngine.java
+++ 
b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpEngine.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.platform.http.spi;
 
-import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.component.platform.http.PlatformHttpEndpoint;
 
@@ -26,13 +25,13 @@ import 
org.apache.camel.component.platform.http.PlatformHttpEndpoint;
 public interface PlatformHttpEngine {
 
     /**
-     * Creates a new {@link Consumer} for the given {@link 
PlatformHttpEndpoint}.
+     * Creates a new {@link PlatformHttpConsumer} for the given {@link 
PlatformHttpEndpoint}.
      *
      * @param  platformHttpEndpoint the {@link PlatformHttpEndpoint} to create 
a consumer for
      * @param  processor            the Processor to pass to
-     * @return                      a new {@link Consumer}
+     * @return                      a new {@link PlatformHttpConsumer}
      */
-    Consumer createConsumer(PlatformHttpEndpoint platformHttpEndpoint, 
Processor processor);
+    PlatformHttpConsumer createConsumer(PlatformHttpEndpoint 
platformHttpEndpoint, Processor processor);
 
     /**
      * The port number the HTTP server is using, if possible to determine.
diff --git 
a/components/camel-platform-http/src/test/java/org/apache/camel/component/platform/http/JettyCustomPlatformHttpConsumer.java
 
b/components/camel-platform-http/src/test/java/org/apache/camel/component/platform/http/JettyCustomPlatformHttpConsumer.java
index 8a2025b847d..b5db315d861 100644
--- 
a/components/camel-platform-http/src/test/java/org/apache/camel/component/platform/http/JettyCustomPlatformHttpConsumer.java
+++ 
b/components/camel-platform-http/src/test/java/org/apache/camel/component/platform/http/JettyCustomPlatformHttpConsumer.java
@@ -23,13 +23,13 @@ import java.io.InputStreamReader;
 import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
 import java.util.StringJoiner;
-import java.util.regex.Pattern;
 
 import jakarta.servlet.http.HttpServletResponse;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
+import org.apache.camel.component.platform.http.spi.PlatformHttpConsumer;
 import org.apache.camel.support.CamelContextHelper;
 import org.apache.camel.support.DefaultConsumer;
 import org.apache.camel.support.DefaultMessage;
@@ -41,8 +41,7 @@ import org.eclipse.jetty.server.Response;
 import org.eclipse.jetty.server.handler.ContextHandler;
 import org.eclipse.jetty.util.Callback;
 
-public class JettyCustomPlatformHttpConsumer extends DefaultConsumer {
-    private static final Pattern PATH_PARAMETER_PATTERN = 
Pattern.compile("\\{([^/}]+)\\}");
+public class JettyCustomPlatformHttpConsumer extends DefaultConsumer 
implements PlatformHttpConsumer {
 
     public JettyCustomPlatformHttpConsumer(PlatformHttpEndpoint endpoint, 
Processor processor) {
         super(endpoint, processor);
diff --git 
a/components/camel-platform-http/src/test/java/org/apache/camel/component/platform/http/JettyCustomPlatformHttpEngine.java
 
b/components/camel-platform-http/src/test/java/org/apache/camel/component/platform/http/JettyCustomPlatformHttpEngine.java
index 93c5811a34c..6e4ae9bad95 100644
--- 
a/components/camel-platform-http/src/test/java/org/apache/camel/component/platform/http/JettyCustomPlatformHttpEngine.java
+++ 
b/components/camel-platform-http/src/test/java/org/apache/camel/component/platform/http/JettyCustomPlatformHttpEngine.java
@@ -16,8 +16,8 @@
  */
 package org.apache.camel.component.platform.http;
 
-import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
+import org.apache.camel.component.platform.http.spi.PlatformHttpConsumer;
 import org.apache.camel.component.platform.http.spi.PlatformHttpEngine;
 import org.apache.camel.support.CamelContextHelper;
 
@@ -26,7 +26,7 @@ public class JettyCustomPlatformHttpEngine implements 
PlatformHttpEngine {
     private int port;
 
     @Override
-    public Consumer createConsumer(PlatformHttpEndpoint platformHttpEndpoint, 
Processor processor) {
+    public PlatformHttpConsumer createConsumer(PlatformHttpEndpoint 
platformHttpEndpoint, Processor processor) {
         if (port == 0) {
             JettyServerTest jettyServerTest = 
CamelContextHelper.mandatoryLookup(
                     platformHttpEndpoint.getCamelContext(),
diff --git 
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/DefaultRestOpenapiProcessorStrategy.java
 
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/DefaultRestOpenapiProcessorStrategy.java
index bd027e97b35..360bc123b45 100644
--- 
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/DefaultRestOpenapiProcessorStrategy.java
+++ 
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/DefaultRestOpenapiProcessorStrategy.java
@@ -36,7 +36,7 @@ import org.apache.camel.NonManagedService;
 import org.apache.camel.Route;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.platform.http.PlatformHttpComponent;
-import org.apache.camel.component.platform.http.PlatformHttpConsumer;
+import org.apache.camel.component.platform.http.spi.PlatformHttpConsumerAware;
 import org.apache.camel.spi.PackageScanResourceResolver;
 import org.apache.camel.spi.ProducerCache;
 import org.apache.camel.spi.Resource;
@@ -67,7 +67,7 @@ public class DefaultRestOpenapiProcessorStrategy extends 
ServiceSupport
     private final List<String> uris = new ArrayList<>();
 
     @Override
-    public void validateOpenApi(OpenAPI openAPI, PlatformHttpConsumer 
platformHttpConsumer) throws Exception {
+    public void validateOpenApi(OpenAPI openAPI, PlatformHttpConsumerAware 
platformHttpConsumer) throws Exception {
         List<String> ids = new ArrayList<>();
         for (var e : openAPI.getPaths().entrySet()) {
             for (var o : e.getValue().readOperations()) {
@@ -134,7 +134,7 @@ public class DefaultRestOpenapiProcessorStrategy extends 
ServiceSupport
                         }
                     }
                 }
-                phc.addHttpEndpoint(uri, verbs, consumes, produces, 
platformHttpConsumer.getDelegtePlatformHttpConsumer());
+                phc.addHttpEndpoint(uri, verbs, consumes, produces, 
platformHttpConsumer.getPlatformHttpConsumer());
                 uris.add(uri);
             }
         }
diff --git 
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
 
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
index fa49ae7dc4b..dee36ced6a1 100644
--- 
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
+++ 
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
@@ -57,7 +57,7 @@ import org.apache.camel.ExchangePattern;
 import org.apache.camel.NoSuchBeanException;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
-import org.apache.camel.component.platform.http.PlatformHttpConsumer;
+import org.apache.camel.component.platform.http.spi.PlatformHttpConsumerAware;
 import 
org.apache.camel.component.rest.openapi.validator.DefaultRequestValidator;
 import org.apache.camel.component.rest.openapi.validator.RequestValidator;
 import org.apache.camel.component.rest.openapi.validator.RestOpenApiOperation;
@@ -296,9 +296,10 @@ public final class RestOpenApiEndpoint extends 
DefaultEndpoint {
         if (factory != null) {
             RestConfiguration config = 
CamelContextHelper.getRestConfiguration(getCamelContext(), cname);
             Map<String, Object> copy = new HashMap<>(parameters); // defensive 
copy of the parameters
-            PlatformHttpConsumer consumer
-                    = (PlatformHttpConsumer) 
factory.createConsumer(getCamelContext(), processor, basePath, config, copy);
-            processor.setPlatformHttpConsumer(consumer);
+            Consumer consumer = factory.createConsumer(getCamelContext(), 
processor, basePath, config, copy);
+            if (consumer instanceof PlatformHttpConsumerAware phca) {
+                processor.setPlatformHttpConsumer(phca);
+            }
             configureConsumer(consumer);
             return consumer;
         } else {
diff --git 
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java
 
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java
index 888cea1fa25..0ef2524a53d 100644
--- 
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java
+++ 
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiProcessor.java
@@ -38,7 +38,7 @@ import org.apache.camel.CamelContextAware;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.StartupStep;
-import org.apache.camel.component.platform.http.PlatformHttpConsumer;
+import org.apache.camel.component.platform.http.spi.PlatformHttpConsumerAware;
 import org.apache.camel.http.base.HttpHelper;
 import org.apache.camel.spi.DataType;
 import org.apache.camel.spi.DataTypeAware;
@@ -77,7 +77,7 @@ public class RestOpenApiProcessor extends 
DelegateAsyncProcessor implements Came
     private final RestOpenapiProcessorStrategy restOpenapiProcessorStrategy;
     private final AtomicBoolean packageScanInit = new AtomicBoolean();
     private final Set<Class<?>> scannedClasses = new HashSet<>();
-    private PlatformHttpConsumer platformHttpConsumer;
+    private PlatformHttpConsumerAware platformHttpConsumer;
 
     public RestOpenApiProcessor(RestOpenApiEndpoint endpoint, OpenAPI openAPI, 
String basePath, String apiContextPath,
                                 Processor processor, 
RestOpenapiProcessorStrategy restOpenapiProcessorStrategy) {
@@ -100,11 +100,11 @@ public class RestOpenApiProcessor extends 
DelegateAsyncProcessor implements Came
         this.camelContext = camelContext;
     }
 
-    public PlatformHttpConsumer getPlatformHttpConsumer() {
+    public PlatformHttpConsumerAware getPlatformHttpConsumer() {
         return platformHttpConsumer;
     }
 
-    public void setPlatformHttpConsumer(PlatformHttpConsumer 
platformHttpConsumer) {
+    public void setPlatformHttpConsumer(PlatformHttpConsumerAware 
platformHttpConsumer) {
         this.platformHttpConsumer = platformHttpConsumer;
     }
 
diff --git 
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenapiProcessorStrategy.java
 
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenapiProcessorStrategy.java
index 7c01fdfb107..bff1e714e42 100644
--- 
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenapiProcessorStrategy.java
+++ 
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenapiProcessorStrategy.java
@@ -20,7 +20,7 @@ import io.swagger.v3.oas.models.OpenAPI;
 import io.swagger.v3.oas.models.Operation;
 import org.apache.camel.AsyncCallback;
 import org.apache.camel.Exchange;
-import org.apache.camel.component.platform.http.PlatformHttpConsumer;
+import org.apache.camel.component.platform.http.spi.PlatformHttpConsumerAware;
 import org.apache.camel.support.processor.RestBindingAdvice;
 
 /**
@@ -59,7 +59,7 @@ public interface RestOpenapiProcessorStrategy {
      * @param  platformHttpConsumer the platform http consumer
      * @throws Exception            is thrown if validation error on startup
      */
-    default void validateOpenApi(OpenAPI openAPI, PlatformHttpConsumer 
platformHttpConsumer) throws Exception {
+    default void validateOpenApi(OpenAPI openAPI, PlatformHttpConsumerAware 
platformHttpConsumer) throws Exception {
         // noop
     }
 
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_6.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_6.adoc
index beac75eedf9..7fe55d34524 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_6.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_6.adoc
@@ -57,3 +57,8 @@ If you are migrating from Camel 4.5, please ensure the 
following
 - Modify the header name `The Output Token Count` from  
`CamelLangChainEmbeddingsOutputTokenCount` to 
`CamelLangChain4jEmbeddingsOutputTokenCount`
 - Modify the header name `The Total Token Count` from  
`CamelLangChainEmbeddingsTotalTokenCount` to 
`CamelLangChain4jEmbeddingsTotalTokenCount`
 - Modify the header name `A dense vector embedding of a text` from  
`CamelLangChainEmbeddingsVector` to `CamelLangChain4jEmbeddingsVector`
+
+=== camel-platform-http
+
+The `PlatformHttpEngine` class has changed the `createConsumer` method to 
return a `org.apache.camel.component.platform.http.spi.PlatformHttpConsumer` 
type,
+instead of `org.apache.camel.Consumer`.

Reply via email to