|
@@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.client.ResourceAccessException;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
+import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
|
|
|
+
|
|
|
import es.uv.garcosda.shared.domain.Mail;
|
|
|
import es.uv.garcosda.shared.domain.MailDTO;
|
|
|
import es.uv.garcosda.shared.domain.User;
|
|
@@ -38,6 +40,7 @@ public class InputController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("{mail}")
|
|
|
+ @HystrixCommand(fallbackMethod="fallbackDataApi")
|
|
|
public ResponseEntity<?> getMails(@PathVariable String mail){
|
|
|
ResponseEntity<Mail[]> response;
|
|
|
List<MailDTO> mailsdto = new ArrayList<MailDTO>();
|
|
@@ -89,4 +92,9 @@ public class InputController {
|
|
|
return new User();
|
|
|
}
|
|
|
|
|
|
+ @SuppressWarnings("unused")
|
|
|
+ private ResponseEntity<?> fallbackDataApi() {
|
|
|
+ return new ResponseEntity<String>("Not available at this moment, try again later.", HttpStatus.SERVICE_UNAVAILABLE);
|
|
|
+ }
|
|
|
+
|
|
|
}
|