Class LoadBalancerRetryContext
java.lang.Object
org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerRetryContext
Stores the data for a load-balanced call that is being retried.
- Since:
- 3.0.0
- Author:
- Olga Maciaszek-Sharma
-
Constructor Summary
ModifierConstructorDescriptionprotected
LoadBalancerRetryContext
(org.springframework.web.reactive.function.client.ClientRequest request) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.web.reactive.function.client.ClientResponse
Returns theClientResponse
returned for load-balanced request.protected org.springframework.web.reactive.function.client.ClientRequest
Returns theClientRequest
that is being load-balanced.protected org.springframework.http.HttpMethod
Returns theHttpMethod
of theClientRequest
that is being load-balanced.protected Integer
Returns the status code from theClientResponse
returned for load-balanced request.protected Integer
Returns the number of times a load-balanced request should be retried on the nextServiceInstance
.protected Integer
Returns the number of times a load-balanced request should be retried on the sameServiceInstance
.protected void
Increments the counter for the retries executed against the sameServiceInstance
.protected void
Increments the counter for the retries executed against the sameServiceInstance
.protected void
Resets the counter for the retries executed against the sameServiceInstance
.protected void
setClientResponse
(org.springframework.web.reactive.function.client.ClientResponse clientResponse) Sets theClientResponse
returned for load-balanced request.
-
Constructor Details
-
LoadBalancerRetryContext
protected LoadBalancerRetryContext(org.springframework.web.reactive.function.client.ClientRequest request)
-
-
Method Details
-
getRequest
protected org.springframework.web.reactive.function.client.ClientRequest getRequest()Returns theClientRequest
that is being load-balanced.- Returns:
- the request that is being load-balanced.
-
getClientResponse
protected org.springframework.web.reactive.function.client.ClientResponse getClientResponse()Returns theClientResponse
returned for load-balanced request.- Returns:
- the response for the load-balanced request.
-
setClientResponse
protected void setClientResponse(org.springframework.web.reactive.function.client.ClientResponse clientResponse) Sets theClientResponse
returned for load-balanced request.- Parameters:
clientResponse
- the response for the load-balanced request.
-
getRetriesSameServiceInstance
Returns the number of times a load-balanced request should be retried on the sameServiceInstance
.- Returns:
- the number of retries
-
incrementRetriesSameServiceInstance
protected void incrementRetriesSameServiceInstance()Increments the counter for the retries executed against the sameServiceInstance
. -
resetRetriesSameServiceInstance
protected void resetRetriesSameServiceInstance()Resets the counter for the retries executed against the sameServiceInstance
. -
getRetriesNextServiceInstance
Returns the number of times a load-balanced request should be retried on the nextServiceInstance
.- Returns:
- the number of retries
-
incrementRetriesNextServiceInstance
protected void incrementRetriesNextServiceInstance()Increments the counter for the retries executed against the sameServiceInstance
. -
getResponseStatusCode
Returns the status code from theClientResponse
returned for load-balanced request.- Returns:
- the status code from the response for the load-balanced request.
-
getRequestMethod
protected org.springframework.http.HttpMethod getRequestMethod()Returns theHttpMethod
of theClientRequest
that is being load-balanced.- Returns:
- the HTTP method of the request that is being load-balanced.
-