Skip to content

Commit

Permalink
Replace deprecated Vert.x Pump use in REST Client
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Jan 13, 2025
1 parent c672a0f commit 1417c2c
Showing 1 changed file with 23 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -308,33 +308,31 @@ public void handle(AsyncResult<AsyncFile> asyncFileOpened) {
return;
}
final AsyncFile tmpAsyncFile = asyncFileOpened.result();
final Pump downloadPump = Pump.pump(clientResponse,
tmpAsyncFile);
downloadPump.start();

clientResponse.resume();
clientResponse.endHandler(new Handler<>() {
public void handle(Void event) {
tmpAsyncFile.flush(new Handler<>() {
public void handle(AsyncResult<Void> flushed) {
if (flushed.failed()) {
reportFinish(flushed.cause(),
requestContext);
requestContext.resume(flushed.cause());
return;
}

if (loggingScope != LoggingScope.NONE) {
clientLogger.logRequest(
httpClientRequest, null, false);
}

requestContext.setTmpFilePath(tmpFilePath);
requestContext.resume();
clientResponse.pipeTo(tmpAsyncFile,
new Handler<>() {
@Override
public void handle(AsyncResult<Void> event) {
tmpAsyncFile.flush(new Handler<>() {
public void handle(AsyncResult<Void> flushed) {
if (flushed.failed()) {
reportFinish(flushed.cause(),
requestContext);
requestContext.resume(flushed.cause());
return;
}

if (loggingScope != LoggingScope.NONE) {
clientLogger.logRequest(
httpClientRequest, null, false);
}

requestContext.setTmpFilePath(tmpFilePath);
requestContext.resume();
}
});
}
});
}
});
clientResponse.resume();
}
});
}
Expand Down

0 comments on commit 1417c2c

Please sign in to comment.