|
|
@ -23,7 +23,6 @@ import reactor.core.publisher.Mono;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
|
import org.springframework.cloud.client.circuitbreaker.CircuitBreakerFactory;
|
|
|
|
import org.springframework.cloud.client.circuitbreaker.CircuitBreakerFactory;
|
|
|
|
import org.springframework.cloud.client.circuitbreaker.ReactiveCircuitBreakerFactory;
|
|
|
|
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
@ -64,9 +63,6 @@ public class CircuitBreakerController {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private CircuitBreakerFactory circuitBreakerFactory;
|
|
|
|
private CircuitBreakerFactory circuitBreakerFactory;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private ReactiveCircuitBreakerFactory reactiveCircuitBreakerFactory;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private WebClient.Builder webClientBuilder;
|
|
|
|
private WebClient.Builder webClientBuilder;
|
|
|
|
|
|
|
|
|
|
|
@ -178,11 +174,6 @@ public class CircuitBreakerController {
|
|
|
|
.get()
|
|
|
|
.get()
|
|
|
|
.uri("/quickstart/callee/circuitBreak")
|
|
|
|
.uri("/quickstart/callee/circuitBreak")
|
|
|
|
.retrieve()
|
|
|
|
.retrieve()
|
|
|
|
.bodyToMono(String.class)
|
|
|
|
.bodyToMono(String.class);
|
|
|
|
.transform(it ->
|
|
|
|
|
|
|
|
reactiveCircuitBreakerFactory
|
|
|
|
|
|
|
|
.create(MetadataContext.LOCAL_NAMESPACE + "QuickstartCalleeService#/quickstart/callee/circuitBreak#http#GET")
|
|
|
|
|
|
|
|
.run(it, throwable -> Mono.just("fallback: trigger the refuse for service callee"))
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|