Created
January 17, 2017 21:48
-
-
Save ianha/12c7ac8fb116fccf19e7c6ebb89be88a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
runHystrixCommand( | |
COMMAND_GROUP, | |
COMMAND_KEY, | |
TIMEOUT_IN_MILLIS, | |
new Callable<Observable<HttpResponse>>() { | |
@Override | |
public Observable<HttpResponse> call() throws Exception { | |
return Observable.just(request.execute().returnResponse()); | |
} | |
} | |
).subscribe(new Action1<HttpResponse>() { | |
@Override | |
public void call(final HttpResponse httpResponse) { | |
statusCode.set(httpResponse.getStatusLine().getStatusCode()); | |
} | |
}, new Action1<Throwable>() { | |
@Override | |
public void call(final Throwable throwable) { | |
logger.error(String.format("Error calling webhook %s", webHook), throwable); | |
statusCode.set(HttpStatus.INTERNAL_SERVER_ERROR.value()); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment