Client: LoadBalanceClient
LoadBalanceClient endpoint provides load balancing functionality over multiple HTTP clients.
Constructor
Load Balancer adds an additional layer to the HTTP client to make network interactions more resilient.
init (*LoadBalanceClientConfiguration loadBalanceClientConfig)
- loadBalanceClientConfig *LoadBalanceClientConfiguration
The configurations for the load balance client endpoint
Remote Methods
post | The POST remote function implementation of the LoadBalancer Connector. |
put | The PUT remote function implementation of the Load Balance Connector. |
patch | The PATCH remote function implementation of the LoadBalancer Connector. |
delete | The DELETE remote function implementation of the LoadBalancer Connector. |
head | The HEAD remote function implementation of the LoadBalancer Connector. |
get | The GET remote function implementation of the LoadBalancer Connector. |
options | The OPTIONS remote function implementation of the LoadBalancer Connector. |
execute | The EXECUTE remote function implementation of the LoadBalancer Connector. |
forward | The FORWARD remote function implementation of the LoadBalancer Connector. |
submit | The submit implementation of the LoadBalancer Connector. |
getResponse | The getResponse implementation of the LoadBalancer Connector. |
hasPromise | The hasPromise implementation of the LoadBalancer Connector. |
getNextPromise | The getNextPromise implementation of the LoadBalancer Connector. |
getPromisedResponse | The getPromisedResponse implementation of the LoadBalancer Connector. |
rejectPromise | The rejectPromise implementation of the LoadBalancer Connector. |
post
function post(string path, RequestMessage message, map<string | string[ ]>? headers, string? mediaType, TargetType targetType) returns targetType | ClientError
The POST remote function implementation of the LoadBalancer Connector.
Parameters
- path string
Resource path
- message RequestMessage
An HTTP outbound request or any allowed payload
- mediaType string? (default ())
The MIME type header of the request entity
- targetType TargetType (default <>)
HTTP response or anydata
, which is expected to be returned after data binding
Return Type
(targetType | ClientError)The response or the payload (if the targetType
is configured) or an http:ClientError
if failed to
establish the communication with the upstream server or a data binding failure
put
function put(string path, RequestMessage message, map<string | string[ ]>? headers, string? mediaType, TargetType targetType) returns targetType | ClientError
The PUT remote function implementation of the Load Balance Connector.
Parameters
- path string
Resource path
- message RequestMessage
An HTTP outbound request or any allowed payload
- mediaType string? (default ())
The MIME type header of the request entity
- targetType TargetType (default <>)
HTTP response or anydata
, which is expected to be returned after data binding
Return Type
(targetType | ClientError)The response or the payload (if the targetType
is configured) or an http:ClientError
if failed to
establish the communication with the upstream server or a data binding failure
patch
function patch(string path, RequestMessage message, map<string | string[ ]>? headers, string? mediaType, TargetType targetType) returns targetType | ClientError
The PATCH remote function implementation of the LoadBalancer Connector.
Parameters
- path string
Resource path
- message RequestMessage
An HTTP outbound request or any allowed payload
- mediaType string? (default ())
The MIME type header of the request entity
- targetType TargetType (default <>)
HTTP response or anydata
, which is expected to be returned after data binding
Return Type
(targetType | ClientError)The response or the payload (if the targetType
is configured) or an http:ClientError
if failed to
establish the communication with the upstream server or a data binding failure
delete
function delete(string path, RequestMessage message, map<string | string[ ]>? headers, string? mediaType, TargetType targetType) returns targetType | ClientError
The DELETE remote function implementation of the LoadBalancer Connector.
Parameters
- path string
Resource path
- message RequestMessage (default ())
An optional HTTP outbound request message or any allowed payload
- mediaType string? (default ())
The MIME type header of the request entity
- targetType TargetType (default <>)
HTTP response or anydata
, which is expected to be returned after data binding
Return Type
(targetType | ClientError)The response or the payload (if the targetType
is configured) or an http:ClientError
if failed to
establish the communication with the upstream server or a data binding failure
head
The HEAD remote function implementation of the LoadBalancer Connector.
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, map<string | string[ ]>? headers, TargetType targetType) returns targetType | ClientError
The GET remote function implementation of the LoadBalancer Connector.
Parameters
- path string
Request path
- targetType TargetType (default <>)
HTTP response or anydata
, which is expected to be returned after data binding
Return Type
(targetType | ClientError)The response or the payload (if the targetType
is configured) or an http:ClientError
if failed to
establish the communication with the upstream server or a data binding failure
options
function options(string path, map<string | string[ ]>? headers, TargetType targetType) returns targetType | ClientError
The OPTIONS remote function implementation of the LoadBalancer Connector.
Parameters
- path string
Request path
- targetType TargetType (default <>)
HTTP response or anydata
, which is expected to be returned after data binding
Return Type
(targetType | ClientError)The response or the payload (if the targetType
is configured) or an http:ClientError
if failed to
establish the communication with the upstream server or a data binding failure
execute
function execute(string httpVerb, string path, RequestMessage message, map<string | string[ ]>? headers, string? mediaType, TargetType targetType) returns targetType | ClientError
The EXECUTE remote function implementation of the LoadBalancer Connector.
Parameters
- httpVerb string
HTTP verb value
- path string
Resource path
- message RequestMessage
An HTTP outbound request or any allowed payload
- mediaType string? (default ())
The MIME type header of the request entity
- targetType TargetType (default <>)
HTTP response or anydata
, which is expected to be returned after data binding
Return Type
(targetType | ClientError)The response or the payload (if the targetType
is configured) or an http:ClientError
if failed to
establish the communication with the upstream server or a data binding failure
forward
function forward(string path, Request request, TargetType targetType) returns targetType | ClientError
The FORWARD remote function implementation of the LoadBalancer Connector.
Parameters
- path string
Resource path
- request Request
An HTTP request
- targetType TargetType (default <>)
HTTP response or anydata
, which is expected to be returned after data binding
Return Type
(targetType | ClientError)The response or the payload (if the targetType
is configured) or an http:ClientError
if failed to
establish the communication with the upstream server or a data binding failure
submit
function submit(string httpVerb, string path, RequestMessage message) returns HttpFuture | ClientError
The submit implementation of the LoadBalancer Connector.
Parameters
- httpVerb string
The HTTP verb value
- path string
The resource path
- 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
The getResponse implementation of the LoadBalancer Connector.
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
The hasPromise implementation of the LoadBalancer Connector.
Parameters
- httpFuture HttpFuture
The http:HttpFuture
related to a previous asynchronous invocation
getNextPromise
function getNextPromise(HttpFuture httpFuture) returns PushPromise | ClientError
The getNextPromise implementation of the LoadBalancer Connector.
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
The getPromisedResponse implementation of the LoadBalancer Connector.
Parameters
- promise PushPromise
The related http:PushPromise
Return Type
(Response | ClientError)A promised http:Response
message or else an http:ClientError
if the invocation fails
rejectPromise
function rejectPromise(PushPromise promise)
The rejectPromise implementation of the LoadBalancer Connector.
Parameters
- promise PushPromise
The Push Promise to be rejected