Class CircuitBreakerAdapterDecorator
java.lang.Object
org.springframework.web.service.invoker.HttpExchangeAdapterDecorator
org.springframework.cloud.client.circuitbreaker.httpservice.CircuitBreakerAdapterDecorator
- All Implemented Interfaces:
org.springframework.web.service.invoker.HttpExchangeAdapter
public class CircuitBreakerAdapterDecorator
extends org.springframework.web.service.invoker.HttpExchangeAdapterDecorator
Blocking implementation of
HttpExchangeAdapterDecorator that wraps
@HttpExchange
In the event of a CircuitBreaker fallback, this class uses the user-provided fallback class to create a proxy. The fallback method is selected by matching either:
- A method with the same name and argument types as the original method, or
- A method with the same name and the original arguments preceded by a
Throwable, allowing the user to access the cause of failure within the fallback.
- Since:
- 5.0.0
- Author:
- Olga Maciaszek-Sharma
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCircuitBreakerAdapterDecorator(org.springframework.web.service.invoker.HttpExchangeAdapter delegate, CircuitBreaker circuitBreaker, Map<String, Class<?>> fallbackClasses) -
Method Summary
Modifier and TypeMethodDescriptionvoidexchange(org.springframework.web.service.invoker.HttpRequestValues requestValues) org.springframework.http.ResponseEntity<Void> exchangeForBodilessEntity(org.springframework.web.service.invoker.HttpRequestValues values) <T> @Nullable TexchangeForBody(org.springframework.web.service.invoker.HttpRequestValues values, org.springframework.core.ParameterizedTypeReference<T> bodyType) <T> org.springframework.http.ResponseEntity<T> exchangeForEntity(org.springframework.web.service.invoker.HttpRequestValues values, org.springframework.core.ParameterizedTypeReference<T> bodyType) org.springframework.http.HttpHeadersexchangeForHeaders(org.springframework.web.service.invoker.HttpRequestValues values) Methods inherited from class org.springframework.web.service.invoker.HttpExchangeAdapterDecorator
getHttpExchangeAdapter, supportsRequestAttributes
-
Constructor Details
-
CircuitBreakerAdapterDecorator
public CircuitBreakerAdapterDecorator(org.springframework.web.service.invoker.HttpExchangeAdapter delegate, CircuitBreaker circuitBreaker, Map<String, Class<?>> fallbackClasses)
-
-
Method Details
-
exchange
public void exchange(org.springframework.web.service.invoker.HttpRequestValues requestValues) - Specified by:
exchangein interfaceorg.springframework.web.service.invoker.HttpExchangeAdapter- Overrides:
exchangein classorg.springframework.web.service.invoker.HttpExchangeAdapterDecorator
-
exchangeForHeaders
public org.springframework.http.HttpHeaders exchangeForHeaders(org.springframework.web.service.invoker.HttpRequestValues values) - Specified by:
exchangeForHeadersin interfaceorg.springframework.web.service.invoker.HttpExchangeAdapter- Overrides:
exchangeForHeadersin classorg.springframework.web.service.invoker.HttpExchangeAdapterDecorator
-
exchangeForBody
public <T> @Nullable T exchangeForBody(org.springframework.web.service.invoker.HttpRequestValues values, org.springframework.core.ParameterizedTypeReference<T> bodyType) - Specified by:
exchangeForBodyin interfaceorg.springframework.web.service.invoker.HttpExchangeAdapter- Overrides:
exchangeForBodyin classorg.springframework.web.service.invoker.HttpExchangeAdapterDecorator
-
exchangeForBodilessEntity
public org.springframework.http.ResponseEntity<Void> exchangeForBodilessEntity(org.springframework.web.service.invoker.HttpRequestValues values) - Specified by:
exchangeForBodilessEntityin interfaceorg.springframework.web.service.invoker.HttpExchangeAdapter- Overrides:
exchangeForBodilessEntityin classorg.springframework.web.service.invoker.HttpExchangeAdapterDecorator
-
exchangeForEntity
public <T> org.springframework.http.ResponseEntity<T> exchangeForEntity(org.springframework.web.service.invoker.HttpRequestValues values, org.springframework.core.ParameterizedTypeReference<T> bodyType) - Specified by:
exchangeForEntityin interfaceorg.springframework.web.service.invoker.HttpExchangeAdapter- Overrides:
exchangeForEntityin classorg.springframework.web.service.invoker.HttpExchangeAdapterDecorator
-