Vertx Webclient : HTTP2 connection management , healthcheck

148 views
Skip to first unread message

sky

unread,
Sep 14, 2022, 12:57:10 PM9/14/22
to vert.x

As HTTP2 connection is persistent connection , is there any way to get current status of
established HTTP2 connection through webClient  ?

Requirement is to 

1) get status of webclient-server connection and raise alarm/faults 
2) currently i think we only get connection status when making requests in form of exception , is there any way to decouple this.

As connection is maintained in pools , is there any api exposed to access them.


Thanks & Regards.

Julien Viet

unread,
Sep 16, 2022, 11:46:45 AM9/16/22
to vert.x
Hi,

HTTP/2 has pingability that Vert.x implements at the connection level.

I think you can use the HttpClient wrapped by the WebClient and then
set a connection handler that ping the connection on a regular basis,
e.g

HttpClient client = // get http client
client.connectionHandler(conn -> {
// Called when a connection is established
int timerID = vertx.setPeriodic(5000, id_ -> {
conn.ping(data).onComplete(ar -> /* handle pong */);;
});
conn.closeHandler(v -> vertx.cancelTimer(timerID));
});

Julien
> --
> 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/8edea112-5673-4b1b-bb64-48f7256632dfn%40googlegroups.com.

sky

unread,
Sep 16, 2022, 1:20:39 PM9/16/22
to vert.x
Hi , Thank You,

Yes , yesterday while going through the documentation , implemented using HttpClient/HttpClientRequest classes.

now next part is "auto-reconnect" when remote server comes up , could not find the way to do that . (using same request client)

Please guide.

Warm Regards

Julien Viet

unread,
Sep 19, 2022, 7:37:16 AM9/19/22
to vert.x
have a look at WebClient interceptors
> To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/4ac4aef5-1956-43a3-9fb7-b9b0c5336eben%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages