Interface SuccessFunction

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

@FunctionalInterface @UnstableApi public interface SuccessFunction
A function that determines whether a Client and Service handled a request successfully or not. This function can be used by the decorators like the following to determine whether the request was handled successfully or not:

Example:


 ServerBuilder sb = Server
         .builder()
         .successFunction((ctx, req) -> req.responseHeaders().status().code() == 200 ||
                                        req.responseHeaders().status().code() == 404)
         .decorator(MetricCollectingService.newDecorator(MeterIdPrefixFunction.ofDefault("myServer")))
         .decorator(LoggingService.newDecorator()));

 WebClient client = WebClient
         .builder(uri)
         .successFunction((ctx, req) -> req.responseHeaders().status().code() == 200 ||
                                        req.responseHeaders().status().code() == 404)
         .decorator(MetricCollectingClient.newDecorator(MeterIdPrefixFunction.ofDefault("myClient")))
         .decorator(LoggingClient.newDecorator()))
         .build();