Class ReactorClientHttpConnector
java.lang.Object
org.springframework.http.client.reactive.ReactorClientHttpConnector
- All Implemented Interfaces:
- ClientHttpConnector
Reactor-Netty implementation of 
ClientHttpConnector.- Since:
- 5.0
- Author:
- Brian Clozel, Rossen Stoyanchev
- See Also:
- 
- HttpClient
 
- 
Constructor SummaryConstructorsConstructorDescriptionDefault constructor.ReactorClientHttpConnector(ReactorResourceFactory factory, Function<reactor.netty.http.client.HttpClient, reactor.netty.http.client.HttpClient> mapper) Constructor with externally managed Reactor Netty resources, includingLoopResourcesfor event loop threads, andConnectionProviderfor the connection pool.ReactorClientHttpConnector(reactor.netty.http.client.HttpClient httpClient) Constructor with a pre-configuredHttpClientinstance.
- 
Method SummaryModifier and TypeMethodDescriptionreactor.core.publisher.Mono<ClientHttpResponse>connect(HttpMethod method, URI uri, Function<? super ClientHttpRequest, reactor.core.publisher.Mono<Void>> requestCallback) Connect to the origin server using the givenHttpMethodandURIand apply the givenrequestCallbackwhen the HTTP request of the underlying API can be initialized and written to.
- 
Constructor Details- 
ReactorClientHttpConnectorpublic ReactorClientHttpConnector()Default constructor. InitializesHttpClientvia:HttpClient.create().compress() 
- 
ReactorClientHttpConnectorpublic ReactorClientHttpConnector(ReactorResourceFactory factory, Function<reactor.netty.http.client.HttpClient, reactor.netty.http.client.HttpClient> mapper) Constructor with externally managed Reactor Netty resources, includingLoopResourcesfor event loop threads, andConnectionProviderfor the connection pool.This constructor should be used only when you don't want the client to participate in the Reactor Netty global resources. By default the client participates in the Reactor Netty global resources held in HttpResources, which is recommended since fixed, shared resources are favored for event loop concurrency. However, consider declaring aReactorResourceFactorybean withglobalResources=truein order to ensure the Reactor Netty global resources are shut down when the Spring ApplicationContext is closed.- Parameters:
- factory- the resource factory to obtain the resources from
- mapper- a mapper for further initialization of the created client
- Since:
- 5.1
 
- 
ReactorClientHttpConnectorpublic ReactorClientHttpConnector(reactor.netty.http.client.HttpClient httpClient) Constructor with a pre-configuredHttpClientinstance.- Parameters:
- httpClient- the client to use
- Since:
- 5.1
 
 
- 
- 
Method Details- 
connectpublic reactor.core.publisher.Mono<ClientHttpResponse> connect(HttpMethod method, URI uri, Function<? super ClientHttpRequest, reactor.core.publisher.Mono<Void>> requestCallback) Description copied from interface:ClientHttpConnectorConnect to the origin server using the givenHttpMethodandURIand apply the givenrequestCallbackwhen the HTTP request of the underlying API can be initialized and written to.- Specified by:
- connectin interface- ClientHttpConnector
- Parameters:
- method- the HTTP request method
- uri- the HTTP request URI
- requestCallback- a function that prepares and writes to the request, returning a publisher that signals when it's done writing. Implementations can return a- Mono<Void>by calling- ReactiveHttpOutputMessage.writeWith(org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer>)or- ReactiveHttpOutputMessage.setComplete().
- Returns:
- publisher for the ClientHttpResponse
 
 
-