Last active
February 17, 2016 20:29
-
-
Save garystafford/d0c42d29f62028ab5c1b 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
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