--
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/d5abeeb4-8f57-4a05-a480-cca4ae49c0fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
@Override
public void start(Future<Void> fut) {
Router router = Router.router(vertx);
router.route().handler(BodyHandler.create());
router.post("/").handler(this::handlePost).produces("application/json");
// Create the HTTP server
int port = CONF_SERVER_PORT.getInteger(env);
vertx.createHttpServer().requestHandler(router::accept).listen(port, result -> {...});
}
private void handlePost(RoutingContext routingContext) {
HttpServerResponse response = routingContext.response();
JsonObject command = routingContext.getBodyAsJson();
NetClientOptions options = new NetClientOptions().setConnectTimeout(10_000).setIdleTimeout(10);
NetClient client = vertx.createNetClient(options);
client.connect(port, host, res -> {
if (res.succeeded()) { // Connected!
NetSocket socket = res.result();
// Send request
socket.write(Buffer.buffer(CodecUtils.encode(command)));
// Handle client
socket.handler(new NetResponsePipeline(vertx, env, socket, response));
// Close client when socket is closed
socket.closeHandler(e -> client.close());
} else {...}
});
}
On Mar 30, 2017, at 9:46 PM, Nicolas Ocquidant <nocqu...@gmail.com> wrote:
Thank you very much for your answer.
The pump you are referring to is the internal mechanism of vertx or do you suggest me to add a pump somewhere?
If I need a pump, I don't know where to put it exactly in my code below…
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/d1069599-f43d-4f92-87b4-1ca7aca6bc63%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/d1069599-f43d-4f92-87b4-1ca7aca6bc63%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/56702FA1-4A60-40DD-BA02-478F2F338579%40julienviet.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/d1069599-f43d-4f92-87b4-1ca7aca6bc63%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.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/56702FA1-4A60-40DD-BA02-478F2F338579%40julienviet.com.