Closed KengoTODA closed 8 years ago
Circuit Breaker Pattern is not for checking connectivity data access layers, it should exist at border between bounded contexts.
It might be better to create a common class which helps microservice to generate HTTP client with Circuit Breaker Pattern and Service Discovery. Currently we have copy-pasted code like below:
private Single<HttpClient> createHttpClientForFileStorage(Future<Void> closed) {
return discovery.getRecordObservable(r -> r.getName().equals("file-storage"))
.map(discovery::getReference)
.flatMap(reference -> {
HttpClient client = new HttpClient(reference.get());
closed.setHandler(ar -> {
reference.release();
});
return Observable.just(client);
})
.toSingle();
}
If we stop using
--link
, application server may be launched before datastore becomes ready. To support this case, it is better to introduce Circuit Breaker Pattern to data access layers.