Interface ExchangeFunction

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface ExchangeFunction
    Represents a function that exchanges a request for a (delayed) ClientResponse. Can be used as an alternative to WebClient.

    For example:

     ExchangeFunction exchangeFunction = ExchangeFunctions.create(new ReactorClientHttpConnector());
     ClientRequest<Void> request = ClientRequest.method(HttpMethod.GET, "https://example.com/resource").build();
    
     Mono<String> result = exchangeFunction
         .exchange(request)
         .then(response -> response.bodyToMono(String.class));
     
    Since:
    5.0
    Author:
    Arjen Poutsma