You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2019/10/30 10:47:58 UTC

[camel-quarkus] 02/02: Fix #299 Use Camel's async processor in platform-http

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

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit ac1ef8f2344a51599efc4a48d48b07f8fb3d96c3
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Wed Oct 30 09:44:22 2019 +0100

    Fix #299 Use Camel's async processor in platform-http
---
 .../http/runtime/QuarkusPlatformHttpConsumer.java        | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java
index 051805c..b9bfa99 100644
--- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java
+++ b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java
@@ -111,13 +111,21 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer {
 
         newRoute.handler(
             ctx -> {
+                Exchange exchg = null;
                 try {
-                    final Exchange e = toExchange(ctx);
-                    getProcessor().process(e);
-                    writeResponse(ctx, e, getEndpoint().getHeaderFilterStrategy());
+                    final Exchange exchange = exchg = toExchange(ctx);
+                    createUoW(exchange);
+                    getAsyncProcessor().process(
+                        exchange,
+                        doneSync -> writeResponse(ctx, exchange, getEndpoint().getHeaderFilterStrategy())
+                    );
                 } catch (Exception e) {
-                    LOG.debugf(e, "Could not handle '%s'", path);
                     ctx.fail(e);
+                    getExceptionHandler().handleException("Failed handling platform-http endpoint " + path, exchg, e);
+                } finally {
+                    if (exchg != null) {
+                        doneUoW(exchg);
+                    }
                 }
             }
         );