use of com.spotify.apollo.test.StubClient.NoMatchingResponseFoundException in project apollo by spotify.
the class FallbackClient method send.
@Override
public CompletionStage<Response<ByteString>> send(Request request, Optional<Request> incoming) {
final CompletionStage<Response<ByteString>> send = mainClient.send(request, incoming);
return fallbackCompose(send, t -> {
if (NoMatchingResponseFoundException.class.isAssignableFrom(t.getClass())) {
NoMatchingResponseFoundException e = (NoMatchingResponseFoundException) t;
LOG.debug("Falling back to real client: {}", e.getMessage());
return fallbackClient.send(request, incoming);
} else {
return send;
}
});
}
Aggregations