--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/b7514032-e2d8-497f-8de2-10e6cd7e067c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/4d2dfceb-b1b6-4ec2-bd53-093570ffecf2%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/4d2dfceb-b1b6-4ec2-bd53-093570ffecf2%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/c883b1f9-1841-4b27-9d9d-6249f99ed6c5%40googlegroups.com.
public class WVerticle extends AbstractVerticle {
private static final Logger logger = LoggerFactory.getLogger(WVerticle.class);
public static void main(String[] args) throws Exception {
VertxOptions vertxOptions = new VertxOptions();
Vertx vertx = Vertx.vertx(vertxOptions);
vertx.deployVerticle(new WVerticle());
}
@Override
public void start() throws Exception {
logger.info("Started");
HttpClient httpClient = vertx.createHttpClient(new HttpClientOptions());
httpClient.get("172.17.0.2", "/file.txt", response -> {
logger.info("Connected");
response.pause();
vertx.fileSystem().open("downloadtest", new OpenOptions().setCreate(true).setTruncateExisting(true), openFileEvent -> {
if (!openFileEvent.succeeded()) {
logger.error("Failed", openFileEvent.cause());
return;
}
logger.info("File created");
AsyncFile file = openFileEvent.result();
Pump downloadPump = Pump.pump(response, file);
downloadPump.start();By the way, I had a closer look at the AsyncFile implementation and the "close" callback should be invoked only when there is no more outstanding writes.
logger.info("Pump started");
response.resume();
logger.info("Response resumed");
response.endHandler(v -> {
logger.info("Response end");
file.flush().close(cv -> logger.info("closed"));
});
});
}).end();
}
}
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/c883b1f9-1841-4b27-9d9d-6249f99ed6c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/30A5F53E-C113-46A5-A71A-AF383CFCC366%40julienviet.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/c883b1f9-1841-4b27-9d9d-6249f99ed6c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.