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


##########
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:
   We can evaluate that in a subsequent improvement, but, for now, I'd rather 
keep the same behavior as before to ensure the refactoring doesn't introduce 
side effects other than those potentially caused by moving things around.



-- 
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