diff --git a/gateleen-logging/src/main/java/org/swisspush/gateleen/logging/LoggingWriteStream.java b/gateleen-logging/src/main/java/org/swisspush/gateleen/logging/LoggingWriteStream.java index 3e0a486f..8c0c7a28 100644 --- a/gateleen-logging/src/main/java/org/swisspush/gateleen/logging/LoggingWriteStream.java +++ b/gateleen-logging/src/main/java/org/swisspush/gateleen/logging/LoggingWriteStream.java @@ -3,6 +3,7 @@ import io.vertx.core.AsyncResult; import io.vertx.core.Future; import io.vertx.core.Handler; +import io.vertx.core.Promise; import io.vertx.core.buffer.Buffer; import io.vertx.core.streams.WriteStream; @@ -36,15 +37,17 @@ public WriteStream exceptionHandler(Handler handler) { @Override public Future write(Buffer data) { + Promise p = Promise.promise(); write(data, event -> { - + if( event.failed() ) p.fail(event.cause()); + else p.complete(); }); - return Future.succeededFuture(); + return p.future(); } @Override public void write(Buffer data, Handler> handler) { - wrappedWriteStream.write(data); + wrappedWriteStream.write(data, handler); if (isRequest) { loggingHandler.appendRequestPayload(data); } else {