Ich baue eine Trainings-App mit Netflix Micro-Services-APIs.TimeoutException in Edge mit Feign und Hystrix
Das ist mein Rand, auf localhost Start: 9999:
@EnableHystrix
@EnableZuulProxy
@EnableEurekaClient
@SpringBootApplication
public class EdgeApplication {
public static void main(String[] args) {
SpringApplication.run(EdgeApplication.class, args);
}
}
ich die 2 folgenden Anwendungen definiert: 8081 app-b
setzt ein:
app-a
einen einfachen Web-Service service-a
und startet auf localhost aussetzt Webdienst service-b
, der service-a
aufruft und auf localhost startet: 8082
service-b
Aufrufe service-a
verwenden Netflix Feign:
@FeignClient(value = "app-a", fallback = AppAFallback.class)
public interface AppAClient {
@RequestMapping(value = "service-a", method = RequestMethod.GET)
List<Entity> serviceA();
}
@Component
public class AppAFallback implements AppAClient {
private static final Entity DEFAULT_ENTITY = new Entity();
@Override
public List<Entity> serviceA() {
return Collections.singletonList(DEFAULT_ENTITY);
}
}
Während app-a
und app-b
ausgeführt werden, wie jeder Dienst Antworten erwartet:
- http://localhost:8081/service-a
- http://localhost:8082/service-b
- http://localhost:9999/app-a/service-a (durch Flanke)
- http://localhost:9999/app-b/service-b (durch Kante)
Der Rückfall sollte AppAFallback
ab, wenn app-b
genannt werden soll. Allerdings muss ich ungefähr 1 Minute warten, bevor es passiert.
Kurz nach dem app-b
ist unten:
- http://localhost:8081/service-a funktioniert gut und das Notfall genannt wird
- http://localhost:8082/service-b nicht erreichbar ist
- http://localhost:9999/app-a/service-a TIMEOUT:
HystrixRuntimeException: app-a timed-out and no fallback available.
- http://localhost:9999/app-b/service-b TIMEOUT:
HystrixRuntimeException: app-b timed-out and no fallback available.
etwa 1 Minute nach app-b
ist unten:
- http://localhost:8081/service-a funktioniert gut und das Notfall genannt wird
- http://localhost:8082/service-b
- http://localhost:9999/app-a/service-a gut funktioniert nicht erreichbar ist und der Rückfall genannt wird
- http://localhost:9999/app-b/service-b ALLGEMEIN: Load Balancer hat keinen verfügbaren Server für den Client:
app-b
Und das ist das Ergebnis, das ich erwartet habe. Irgendeine Idee über, warum die Anrufe zu app-a/service-a
gerade nach app-b
unten sind, geben mir TIMEOUT?
Vielen Dank im Voraus für Ihre Hilfe.