Skip to content

Instantly share code, notes, and snippets.

@ereshzealous
Created December 13, 2019 10:25
Show Gist options
  • Save ereshzealous/f20e1cf400834bdbdc04fdc9706e1117 to your computer and use it in GitHub Desktop.
Save ereshzealous/f20e1cf400834bdbdc04fdc9706e1117 to your computer and use it in GitHub Desktop.
@GetMapping("/discounts")
@HystrixCommand(fallbackMethod = "getDefaultDiscount", commandKey = "getDefaultDiscount")
public ResponseEntity<WSDiscount> getProductDiscount(@RequestParam("id") String id) {
ResponseEntity<WSDiscount> responseEntity =
baseRestOutboundProcessor.get("https://discount-service.com?id=" + id, null, WSDiscount.class, new HashMap<>());
return ResponseEntity.ok(responseEntity.getBody());
}
public ResponseEntity<WSDiscount> getDefaultDiscount(String id) {
WSDiscount discount = new WSDiscount();
discount.setMaxDiscount("0");
discount.setProductId(id);
return ResponseEntity.ok(discount);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment