Skip to content

Instantly share code, notes, and snippets.

@garystafford
Last active February 17, 2016 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garystafford/d0c42d29f62028ab5c1b to your computer and use it in GitHub Desktop.
Save garystafford/d0c42d29f62028ab5c1b to your computer and use it in GitHub Desktop.
public Collection<String> getReservationNameFallback() {
return emptyList();
}
@HystrixCommand(fallbackMethod = "getReservationNameFallback", commandProperties = {
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "3000")
})
@RequestMapping(path = "/names", method = RequestMethod.GET)
public Collection<String> getReservationNames() {
ParameterizedTypeReference<Resources<Reservation>> ptr =
new ParameterizedTypeReference<Resources<Reservation>>() {
};
return this.restTemplate.exchange(
"http://reservation-service/reservations", GET, null, ptr)
.getBody()
.getContent()
.stream()
.map(Reservation::getReservationName)
.collect(toList());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment