This module provides to use Reactor Netty as reactive, non-blocking HTTP client implementation.
<dependency>
<groupId>com.github.ljtfreitas.julian-http-client</groupId>
<artifactId>julian-http-client-http-client-reactor-netty</artifactId>
<version>${julian-http-client-version}</version>
</dependency>
dependencies {
implementation("com.github.ljtfreitas.julian-http-client:julian-http-client-reactor-netty:$julianHttpClientVersion")
}
We need to configure the ProxyBuilder
to use the implementation provided for this module:
import com.github.ljtfreitas.julian.http.client.reactor.ReactorNettyHTTPClient;
interface MyApi {}
ReactorNettyHTTPClient reactorNettyHTTPClient = new ReactorNettyHTTPClient();
MyApi myApi = new ProxyBuilder()
.http()
.client()
.with(reactorNettyHTTPClient)
.and()
.build(MyApi.class, "http://my.api.com");
ReactorNettyHTTPClient
uses a default HttpClient, but we can customize it:
import com.github.ljtfreitas.julian.http.client.reactor.ReactorNettyHTTPClient;
import reactor.netty.http.client.HttpClient;
interface MyApi {}
HttpClient httpClient = HttpClient
.create()
// other HttpClient options here...
ReactorNettyHTTPClient reactorNettyHTTPClient = new ReactorNettyHTTPClient(httpClient);
MyApi myApi = new ProxyBuilder()
.http()
.client()
.with(reactorNettyHTTPClient)
.and()
.build(MyApi.class, "http://my.api.com");