-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Hi Guss77,
First of all, thanks for your library. I need to write a large amount of data into a HttpServerResponse to return these data to an http client without overloading the server's memory. I tried to customize your code from OutputToReadStreamTest as follows:
HttpServerResponse response = requestContext.getResponse();
OutputToReadStream stream = new OutputToReadStream(vertx);
stream.pipeTo(response);
vertx.runOnContext(p -> {
try {
byte[] data = new byte[...];
while (...) {
readMyData(data);
stream.write(data);
}
stream.close();
p.complete();
} catch (IOException e) {
p.fail(e);
}
...
response.end();
});
The problem is that the "stream.write(data)" command is blocking on the first write. Is the OutputToReadStream class supposed to work with an HttpServerResponse as WriteStream? Dit I do something wrong in my implementation ?
Thanks
Eric
Metadata
Metadata
Assignees
Labels
No labels