can we use webclient API from in mono core environment?
For Example
Func A()
{
while(1)
{
....
// Call webclint API
Client.getWebClient().post().uri(test\_uri)
.header(HttpHeaders.CONTENT\_TYPE, MediaType.APPLICATION\_JSON\_VALUE)
.body(Mono.just(record.value()), String.class)
.accept(MediaType.APPLICATION\_JSON).exchangeToMono(response -> {
if (response.statusCode().equals(HttpStatus.OK)) {
logger.info("received 200 OK");
return response.bodyToMono(String.class);
} else if (response.statusCode().is4xxClientError()) {
return response.createException().flatMap(Mono::error).onErrorReturn(
WebClientRequestException.class,
"4xx");
} else if (response.statusCode().is5xxServerError()) {
return response.createException().flatMap(Mono::error).onErrorReturn(
WebClientRequestException.class,
"5xx");
}
return null;
}).onErrorMap(WebClientRequestException.class, throwable -> {
return throwable;
}).onErrorReturn(WebClientRequestException.class,
"Unavailable")
.subscribe();
....
}
}
I am observing memory of applicatiion is increasing with every webclient API call. As per MAT, netty event poll handler is getting most the memory.
Could you please suggest anything?