This is an automated email from the ASF dual-hosted git repository. apupier pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 5c20bbd37f05773c2b7bd834c35de02b233d2462 Author: Aurélien Pupier <[email protected]> AuthorDate: Tue Sep 15 16:18:26 2026 +0200 Replace deprecated methods in vertx platform one tricky change is to use the endOnfailure(false) on the pipe() replacing the Pump to preserve the behavior of exception co-authored-by: IBM Bob 2.0.3 Signed-off-by: Aurélien Pupier <[email protected]> --- .../http/vertx/VertxPlatformHttpRouter.java | 1 + .../http/vertx/VertxPlatformHttpSupport.java | 25 +++++++++------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpRouter.java b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpRouter.java index 0a5f5840f413..9dcd5081df3a 100644 --- a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpRouter.java +++ b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpRouter.java @@ -269,6 +269,7 @@ public class VertxPlatformHttpRouter implements Router { } @Override + @Deprecated(since = "4.23") public Route mountSubRouter(String mountPoint, Router subRouter) { if (mountPoint.endsWith("*")) { throw new IllegalArgumentException("Don't include * when mounting a sub router"); diff --git a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpSupport.java b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpSupport.java index b731f93fadd4..6bbc0148dc10 100644 --- a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpSupport.java +++ b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpSupport.java @@ -33,7 +33,6 @@ import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpServerRequest; import io.vertx.core.http.HttpServerResponse; import io.vertx.core.net.SocketAddress; -import io.vertx.core.streams.Pump; import io.vertx.ext.web.RoutingContext; import org.apache.camel.Exchange; import org.apache.camel.Message; @@ -243,20 +242,16 @@ public final class VertxPlatformHttpSupport { // Process the InputStream async to avoid blocking the Vert.x event loop on large responses AsyncInputStream asyncInputStream = new AsyncInputStream(vertx, context, is, eagerFlush); - asyncInputStream.exceptionHandler(promise::fail); - asyncInputStream.endHandler(event -> endHandler(promise, response, asyncInputStream)); - - // Pump the InputStream content into the HTTP response WriteStream - Pump pump = Pump.pump(asyncInputStream, response); - context.runOnContext(event -> pump.start()); - } - - private static void endHandler(Promise<Void> promise, HttpServerResponse response, AsyncInputStream asyncInputStream) { - response.end().onComplete(result -> onComplete(promise, asyncInputStream)); - } - - private static void onComplete(Promise<Void> promise, AsyncInputStream asyncInputStream) { - asyncInputStream.close(closeResult -> promise.complete()); + context.runOnContext(event -> asyncInputStream.pipe() + .endOnFailure(false) + .to(response) + .onComplete(result -> asyncInputStream.close(closeResult -> { + if (result.failed()) { + promise.fail(result.cause()); + } else { + promise.complete(); + } + }))); } static void populateCamelHeaders(
