Client: CircuitBreakerClient

Isolated

A Circuit Breaker implementation which can be used to gracefully handle network failures.

Remote Methods

post

The POST remote function implementation of the Circuit Breaker.

head

The HEAD remote function implementation of the Circuit Breaker.

put

The PUT remote function implementation of the Circuit Breaker.

execute

This wraps the CircuitBreakerClient.post() function of the underlying HTTP remote functions provider.

patch

The PATCH remote function implementation of the Circuit Breaker.

delete

The DELETE remote function implementation of the Circuit Breaker.

get

The GET remote function implementation of the Circuit Breaker.

options

The OPTIONS remote function implementation of the Circuit Breaker.

forward

This wraps the CircuitBreakerClient.forward() function of the underlying HTTP remote functions provider.

submit

Submits an HTTP request to a service with the specified HTTP verb.

getResponse

Retrieves the http:Response for a previously-submitted request.

hasPromise

Circuit breaking is not supported.

getNextPromise

Retrieves the next available http:PushPromise for a previously-submitted request.

getPromisedResponse

Retrieves the promised server push Response message.

rejectPromise

Circuit breaking is not supported.

Methods

forceClose

Force the circuit into a closed state in which it will allow requests regardless of the error percentage until the failure threshold exceeds.

forceOpen

Force the circuit into a open state in which it will suspend all requests until resetTime interval exceeds.

getCurrentState

Provides the http:CircuitState of the circuit breaker.

Fields

  • httpClient HttpClient
  • The underlying HttpActions instance which will be making the actual network calls

post

function post(string path, RequestMessage message) returns Response | ClientError
Isolated Function
Remote Function

The POST remote function implementation of the Circuit Breaker. This wraps the CircuitBreakerClient.post() function of the underlying HTTP remote functions provider.

Parameters

  • message RequestMessage
  • An HTTP outbound request or any allowed payload

Return Type

(Response | ClientError)

The response or an http:ClientError if failed to establish the communication with the upstream server

function head(string path, RequestMessage message) returns Response | ClientError
Isolated Function
Remote Function

The HEAD remote function implementation of the Circuit Breaker. This wraps the CircuitBreakerClient.head() function of the underlying HTTP remote functions provider.

Parameters

  • message RequestMessage (default ())
  • An optional HTTP outbound request or any allowed payload

Return Type

(Response | ClientError)

The response or an http:ClientError if failed to establish the communication with the upstream server

put

function put(string path, RequestMessage message) returns Response | ClientError
Isolated Function
Remote Function

The PUT remote function implementation of the Circuit Breaker. This wraps the CircuitBreakerClient.put() function of the underlying HTTP remote functions provider.

Parameters

  • message RequestMessage
  • An HTTP outbound request or any allowed payload

Return Type

(Response | ClientError)

The response or an http:ClientError if failed to establish the communication with the upstream server

execute

function execute(string httpVerb, string path, RequestMessage message) returns Response | ClientError
Isolated Function
Remote Function

This wraps the 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

  • message RequestMessage
  • An HTTP outbound request or any allowed payload

Return Type

(Response | ClientError)

The response or an http:ClientError if failed to establish the communication with the upstream server

patch

function patch(string path, RequestMessage message) returns Response | ClientError
Isolated Function
Remote Function

The PATCH remote function implementation of the Circuit Breaker. This wraps the CircuitBreakerClient.patch() function of the underlying HTTP remote functions provider.

Parameters

  • message RequestMessage
  • An HTTP outbound request or any allowed payload

Return Type

(Response | ClientError)

The response or an http:ClientError if failed to establish the communication with the upstream server

delete

function delete(string path, RequestMessage message) returns Response | ClientError
Isolated Function
Remote Function

The DELETE remote function implementation of the Circuit Breaker. This wraps the CircuitBreakerClient.delete() function of the underlying HTTP remote functions provider.

Parameters

  • message RequestMessage (default ())
  • An optional HTTP outbound request or any allowed payload

Return Type

(Response | ClientError)

The response or an http:ClientError if failed to establish the communication with the upstream server

get

function get(string path, RequestMessage message) returns Response | ClientError
Isolated Function
Remote Function

The GET remote function implementation of the Circuit Breaker. This wraps the CircuitBreakerClient.get() function of the underlying HTTP remote functions provider.

Parameters

  • message RequestMessage (default ())
  • An optional HTTP outbound request or any allowed payload

Return Type

(Response | ClientError)

The response or an http:ClientError if failed to establish the communication with the upstream server

options

function options(string path, RequestMessage message) returns Response | ClientError
Isolated Function
Remote Function

The OPTIONS remote function implementation of the Circuit Breaker. This wraps the CircuitBreakerClient.options() function of the underlying HTTP remote functions provider.

Parameters

  • message RequestMessage (default ())
  • An optional HTTP outbound request or any allowed payload

Return Type

(Response | ClientError)

The response or an http:ClientError if failed to establish the communication with the upstream server

forward

function forward(string path, Request request) returns Response | ClientError
Isolated Function
Remote Function

This wraps the 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.

Parameters

Return Type

(Response | ClientError)

The response or an http:ClientError if failed to establish the communication with the upstream server

submit

function submit(string httpVerb, string path, RequestMessage message) returns HttpFuture | ClientError
Isolated Function
Remote Function

Submits an HTTP request to a service with the specified HTTP verb. The 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

  • message RequestMessage
  • An HTTP outbound request or any allowed payload

Return Type

(HttpFuture | ClientError)

An http:HttpFuture that represents an asynchronous service invocation or else an http:ClientError if the submission fails

getResponse

function getResponse(HttpFuture httpFuture) returns Response | ClientError
Isolated Function
Remote Function

Retrieves the 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 an http:ClientError if the invocation fails

hasPromise

function hasPromise(HttpFuture httpFuture) returns boolean
Isolated Function
Remote Function

Circuit breaking is not supported. The default value is the 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 an http:PushPromise exists

getNextPromise

function getNextPromise(HttpFuture httpFuture) returns PushPromise | ClientError
Isolated Function
Remote Function

Retrieves the next available 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 an http:ClientError if the invocation fails

getPromisedResponse

function getPromisedResponse(PushPromise promise) returns Response | ClientError
Isolated Function
Remote Function

Retrieves the promised server push Response message.

Parameters

Return Type

(Response | ClientError)

A promised http:Response message or else an http:ClientError if the invocation fails

rejectPromise

function rejectPromise(PushPromise promise)
Isolated Function
Remote Function

Circuit breaking is not supported. The default value is the CircuitBreakerClient.rejectPromise() function of the underlying HTTP remote functions provider.

Parameters

  • promise PushPromise
  • The http:PushPromise to be rejected

forceClose

function forceClose()
Isolated Function

Force the circuit into a closed state in which it will allow requests regardless of the error percentage until the failure threshold exceeds.

forceOpen

function forceOpen()
Isolated Function

Force the circuit into a open state in which it will suspend all requests until resetTime interval exceeds.

getCurrentState

function getCurrentState() returns CircuitState
Isolated Function

Provides the http:CircuitState of the circuit breaker.

Return Type

(CircuitState)

The current http:CircuitState of the circuit breaker