jamesnetherton commented on code in PR #11868:
URL: https://github.com/apache/camel/pull/11868#discussion_r1375906384


##########
components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java:
##########
@@ -183,35 +184,44 @@ protected void handleRequest(RoutingContext ctx) {
             handleProxy(ctx, exchange);
         }
 
-        vertx.executeBlocking(() -> {
-            createUoW(exchange);
-            getProcessor().process(exchange);
-            return null;
-        }, false)
-                .onComplete(result -> {
-                    Throwable failure = null;
-                    try {
-                        if (result.succeeded()) {
-                            try {
-                                writeResponse(ctx, exchange, 
getEndpoint().getHeaderFilterStrategy(), muteExceptions);
-                            } catch (Exception e) {
-                                failure = e;
-                            }
-                        } else {
-                            failure = result.cause();
-                        }
-
-                        if (failure != null) {
-                            getExceptionHandler().handleException(
-                                    "Failed handling platform-http endpoint " 
+ getEndpoint().getPath(),
-                                    failure);
-                            ctx.fail(failure);
-                        }
-                    } finally {
-                        doneUoW(exchange);
-                        releaseExchange(exchange, false);
-                    }
-                });
+        vertx.executeBlocking(() -> processRequest(exchange), false)
+                .onComplete(result -> processResult(ctx, result, exchange));
+    }
+
+    private void processResult(
+            RoutingContext ctx, AsyncResult<Object> result, Exchange exchange) 
{
+        Throwable failure = null;
+        try {
+            if (result.succeeded()) {
+                try {
+                    writeResponse(ctx, exchange, 
getEndpoint().getHeaderFilterStrategy(), muteExceptions);
+                } catch (Exception e) {
+                    failure = e;
+                }
+            } else {
+                failure = result.cause();
+            }
+
+            if (failure != null) {
+                handleFailure(ctx, failure);
+            }
+        } finally {
+            doneUoW(exchange);
+            releaseExchange(exchange, false);
+        }
+    }
+
+    private void handleFailure(RoutingContext ctx, Throwable failure) {
+        getExceptionHandler().handleException(
+                "Failed handling platform-http endpoint " + 
getEndpoint().getPath(),
+                failure);
+        ctx.fail(failure);
+    }
+
+    private Object processRequest(Exchange exchange) throws Exception {

Review Comment:
   Since `executeBlocking` expects `Callable<Void>` in this case, maybe return 
that instead of a `null` `Object`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to