Clients -
http :
CircuitBreakerClient
A Circuit Breaker implementation which can be used to gracefully handle network failures.
Constructor
__init
(string url, ClientConfiguration config, CircuitBreakerInferredConfig circuitBreakerInferredConfig, HttpClient httpClient, CircuitHealth circuitHealth)
- url string
-
The URL of the target service
- config ClientConfiguration
-
The configurations of the client endpoint associated with this
CircuitBreaker
instance
- circuitBreakerInferredConfig CircuitBreakerInferredConfig
-
Configurations derived from the
http:CircuitBreakerConfig
- httpClient HttpClient
-
The underlying
HttpActions
instance, which will be making the actual network calls
- circuitHealth CircuitHealth
-
The circuit health monitor
Methods
CircuitBreakerClient.post()
function of the underlying HTTP remote functions provider.
CircuitBreakerClient.head()
function of the underlying HTTP remote functions provider.
CircuitBreakerClient.put()
function of the underlying HTTP remote functions provider.
CircuitBreakerClient.post()
function of the underlying HTTP remote functions provider.
The CircuitBreakerClient.execute()
function can be used to invoke an HTTP call with the given HTTP verb.
CircuitBreakerClient.patch()
function of the underlying HTTP remote functions provider.
CircuitBreakerClient.delete()
function of the underlying HTTP remote functions provider.
CircuitBreakerClient.get()
function of the underlying HTTP remote functions provider.
CircuitBreakerClient.options()
function of the underlying HTTP remote functions provider.
CircuitBreakerClient.forward()
function of the underlying HTTP remote functions provider.
The Forward remote function can be used to forward an incoming request to an upstream service as it is.
CircuitBreakerClient.submit()
function does not give out a Response
as the result.
Rather it returns an http:HttpFuture
which can be used to do further interactions with the endpoint.
http:Response
for a previously-submitted request.
CircuitBreakerClient.hasPromise()
function of the underlying
HTTP remote functions provider.
http:PushPromise
for a previously-submitted request.
Response
message.
CircuitBreakerClient.rejectPromise()
function of the underlying
HTTP remote functions provider.
resetTimeInMillis
interval exceeds.
http:CircuitState
of the circuit breaker.
Fields
- url string
-
The URL of the target service
- config ClientConfiguration
-
The configurations of the client endpoint associated with this
CircuitBreaker
instance
- circuitBreakerInferredConfig CircuitBreakerInferredConfig
-
Configurations derived from
CircuitBreakerConfig
- httpClient HttpClient
-
The underlying
HttpActions
instance which will be making the actual network calls
- circuitHealth CircuitHealth
-
The circuit health monitor
- currentCircuitState CircuitState (default CB_CLOSED_STATE)
-
The current state the circuit is in
CircuitBreakerClient.post()
function of the underlying HTTP remote functions provider.
Parameters
- path string
-
Resource path
- message RequestMessage
-
A Request or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
CircuitBreakerClient.head()
function of the underlying HTTP remote functions provider.
Parameters
- path string
-
Resource path
- message RequestMessage (default ())
-
A Request or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
CircuitBreakerClient.put()
function of the underlying HTTP remote functions provider.
Parameters
- path string
-
Resource path
- message RequestMessage
-
A Request or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
CircuitBreakerClient.post()
function of the underlying HTTP remote functions provider.
The CircuitBreakerClient.execute()
function can be used to invoke an HTTP call with the given HTTP verb.
Parameters
- httpVerb string
-
HTTP verb to be used for the request
- path string
-
Resource path
- message RequestMessage
-
A Request or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
CircuitBreakerClient.patch()
function of the underlying HTTP remote functions provider.
Parameters
- path string
-
Resource path
- message RequestMessage
-
A Request or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
CircuitBreakerClient.delete()
function of the underlying HTTP remote functions provider.
Parameters
- path string
-
Resource path
- message RequestMessage (default ())
-
A Request or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
CircuitBreakerClient.get()
function of the underlying HTTP remote functions provider.
Parameters
- path string
-
Resource path
- message RequestMessage (default ())
-
An optional HTTP request or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
CircuitBreakerClient.options()
function of the underlying HTTP remote functions provider.
Parameters
- path string
-
Resource path
- message RequestMessage (default ())
-
An optional HTTP Request or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
CircuitBreakerClient.forward()
function of the underlying HTTP remote functions provider.
The Forward remote function can be used to forward an incoming request to an upstream service as it is.
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
CircuitBreakerClient.submit()
function does not give out a Response
as the result.
Rather it returns an http:HttpFuture
which can be used to do further interactions with the endpoint.
Parameters
- httpVerb string
-
The HTTP verb value
- path string
-
The resource path
- message RequestMessage
-
An HTTP outbound request message or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
ormime:Entity[]
-
Return Type
(HttpFuture | ClientError) An
http:HttpFuture
that represents an asynchronous service invocation or else anhttp:ClientError
if the submission fails
http:Response
for a previously-submitted request.
Parameters
- httpFuture HttpFuture
-
The
http:HttpFuture
related to a previous asynchronous invocation
-
Return Type
(Response | ClientError) An
http:Response
message or else anhttp:ClientError
if the invocation fails
CircuitBreakerClient.hasPromise()
function of the underlying
HTTP remote functions provider.
Parameters
- httpFuture HttpFuture
-
The
http:HttpFuture
related to a previous asynchronous invocation
-
Return Type
(boolean) A
boolean
, which represents whether anhttp:PushPromise
exists
http:PushPromise
for a previously-submitted request.
Parameters
- httpFuture HttpFuture
-
The
http:HttpFuture
related to a previous asynchronous invocation
-
Return Type
(PushPromise | ClientError) An
http:PushPromise
message or else anhttp:ClientError
if the invocation fails
Response
message.
Parameters
- promise PushPromise
-
The related
http:PushPromise
-
Return Type
(Response | ClientError) A promised
http:Response
message or else anhttp:ClientError
if the invocation fails
CircuitBreakerClient.rejectPromise()
function of the underlying
HTTP remote functions provider.
Parameters
- promise PushPromise
-
The
http:PushPromise
to be rejected
resetTimeInMillis
interval exceeds.
http:CircuitState
of the circuit breaker.
-
Return Type
(CircuitState) The current
http:CircuitState
of the circuit breaker