Blocking call in new async Java API Client?

I'm trying to migrate from the old RestHighLevelClient to the new Java API Client (v7.16.0) in a Spring Webflux project. With the old client I was able to convert the response to a Mono<> using the client's listener mechanism. The new client using CompletableFuture sounds much easier, but my IDE is warning me about an "Inappropriate blocking method call":

return Mono.fromFuture(
  asyncClient.search(new SearchRequest.Builder().build(), Document.class)
);

Has anyone run into this? Is there some non-async IO the new client is doing in addition to the work done as part of the future? Or is IntelliJ not analyzing it correctly somehow?

The async client is fully async. I tried to reproduce the warning but my IntelliJ stays silent. Do you have a specific plugin or configuration that would trigger it (I guess that should be the job of the Reactive Streams plugin).

That warning may be triggered by the fact that in 7.16 the async client methods are declared to throw an IOException. That exception is actually never thrown (because it's async) and has been removed in 7.17.

Hope this helps.

1 Like

Excellent, yes I just tested it and the warning goes away in 7.17. Thanks a lot for your help!

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.