final HttpServer httpServer = vertx.createHttpServer();
Router router = Router.router(vertx);
router.route().handler(TimeoutHandler.create(1000));
router.route().handler(routingContext -> {
System.out.println("Standard Route");
HttpServerResponse response = routingContext.response();
...... other logic here...
response.end("<html><body><h1>Hello</h1></body></html>");
});
httpServer.requestHandler(router::accept);
httpServer.listen(8080);
So my expectation was that all RoutingContexts not being responded in 1 seconds should return HTTP Status 408 triggered when the timer started in TimeoutHandler times out.
If I add some business logic that causes the second route handler to take longer then the 1 second timeout I don't get the expected effect, the response is still sent back to the client as if no timeout occurs.
However when I for example don't end the response in the second route handler the timeout is returned successfully - that is working as expected.
When running the second route handler in a blocking handler (and sending a response as in code above) then the timer works as expected and returns the 408 Status.
So my question would be if that is the to be expected behavior having that timeout not triggered for a non blocking handler that exceeds the timeout period?
Thanks
Roman
Hi
I am relatively new to vert.x and I started to try out the web part, using routes etc.
So far everything works really nice....
Now what I wanted to do is use the TimeoutHandler that comes with 3.1.0, basically I did that by defining it as first route (so its timer gets started as first action), and afterwards I add my other routes, e.g. like:
final HttpServer httpServer = vertx.createHttpServer();
Router router = Router.router(vertx);
router.route().handler(TimeoutHandler.create(1000));
router.route().handler(routingContext -> {
System.out.println("Standard Route");
HttpServerResponse response = routingContext.response();
...... other logic here...
response.end("<html><body><h1>Hello</h1></body></html>");
});
httpServer.requestHandler(router::accept);
httpServer.listen(8080);
So my expectation was that all RoutingContexts not being responded in 1 seconds should return HTTP Status 408 triggered when the timer started in TimeoutHandler times out.
If I add some business logic that causes the second route handler to take longer then the 1 second timeout
I don't get the expected effect, the response is still sent back to the client as if no timeout occurs.
However when I for example don't end the response in the second route handler the timeout is returned successfully - that is working as expected.
When running the second route handler in a blocking handler (and sending a response as in code above) then the timer works as expected and returns the 408 Status.
So my question would be if that is the to be expected behavior having that timeout not triggered for a non blocking handler that exceeds the timeout period?
Thanks
Roman
--
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 http://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/613c6beb-146d-4fb5-8529-4da5672a465c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.