Search in sources :

Example 1 with NoMatchingResponseFoundException

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;
        }
    });
}
Also used : Response(com.spotify.apollo.Response) NoMatchingResponseFoundException(com.spotify.apollo.test.StubClient.NoMatchingResponseFoundException)

Aggregations

Response (com.spotify.apollo.Response)1 NoMatchingResponseFoundException (com.spotify.apollo.test.StubClient.NoMatchingResponseFoundException)1