Clients
-
http
:
RetryClient
Provides the HTTP remote functions for interacting with an HTTP endpoint. This is created by wrapping the HTTP client to provide retrying over HTTP requests.
Constructor
Provides the HTTP remote functions for interacting with an HTTP endpoint. This is created by wrapping the HTTP client to provide retrying over HTTP requests.
__init
(string url, ClientConfiguration config, RetryInferredConfig retryInferredConfig, HttpClient httpClient)
- url string
-
Target service url
- config ClientConfiguration
-
HTTP ClientConfiguration to be used for HTTP client invocation
- retryInferredConfig RetryInferredConfig
-
Derived set of configurations associated with retry
- httpClient HttpClient
-
HTTP client for outbound HTTP requests
Remote Methods
post | The |
head | The |
put | The |
forward | The |
execute | The |
patch | The |
delete | The |
get | The |
options | The |
submit | Submits an HTTP request to a service with the specified HTTP verb.
The |
getResponse | Retrieves the |
hasPromise | Checks whether an |
getNextPromise | Retrieves the next available |
getPromisedResponse | Retrieves the promised server push |
rejectPromise | Rejects an |
Fields
- url string
-
Target service url
- config ClientConfiguration
-
HTTP ClientConfiguration to be used for HTTP client invocation
- retryInferredConfig RetryInferredConfig
-
Derived set of configurations associated with retry
- httpClient HttpClient
-
Chain of different HTTP clients which provides the capability for initiating contact with a remote HTTP service in resilient manner.
The RetryClient.post()
function wraps the underlying HTTP remote functions in a way to provide
retrying functionality for a given endpoint to recover from network level failures.
Parameters
- path string
-
Resource path
- message RequestMessage
-
An HTTP outbound request message or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) An
http:Response
message or else anhttp:ClientError
if the invocation fails
The RetryClient.head()
function wraps the underlying HTTP remote functions in a way to provide
retrying functionality for a given endpoint to recover from network level failures.
Parameters
- path string
-
Resource path
- message RequestMessage (default <(ballerina/http:1.0.0:Request|string|xml|json|byte[]|ballerina/io:0.5.0:ReadableByteChannel|ballerina/mime:1.0.0:Entity[])> ())
-
An HTTP outbound request message or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) An
http:Response
message or else anhttp:ClientError
if the invocation fails
The RetryClient.put()
function wraps the underlying HTTP remote function in a way to provide
retrying functionality for a given endpoint to recover from network level failures.
Parameters
- path string
-
Resource path
- message RequestMessage
-
An HTTP outbound request message or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) An
http:Response
message or else anhttp:ClientError
if the invocation fails
The RetryClient.forward()
function wraps the underlying HTTP remote function in a way to provide retrying
functionality for a given endpoint with inbound request's HTTP verb to recover from network level failures.
-
Return Type
(Response | ClientError) An
http:Response
message or else anhttp:ClientError
if the invocation fails
The RetryClient.execute()
sends an HTTP request to a service with the specified HTTP verb. The function wraps
the underlying HTTP remote function in a way to provide retrying functionality for a given endpoint to recover
from network level failures.
Parameters
- httpVerb string
-
The HTTP verb value
- path string
-
Resource path
- message RequestMessage
-
An HTTP outbound request message or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
, ormime:Entity[]
-
Return Type
(Response | ClientError) An
http:Response
message or else anhttp:ClientError
if the invocation fails
The RetryClient.patch()
function wraps the underlying HTTP remote function in a way to provide
retrying functionality for a given endpoint to recover from network level failures.
Parameters
- path string
-
Resource path
- message RequestMessage
-
An HTTP outbound request message or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
, ormime:Entity[]
-
Return Type
(Response | ClientError) An
http:Response
message or else anhttp:ClientError
if the invocation fails
The RetryClient.delete()
function wraps the underlying HTTP remote function in a way to provide
retrying functionality for a given endpoint to recover from network level failures.
Parameters
- path string
-
Resource path
- message RequestMessage (default <(ballerina/http:1.0.0:Request|string|xml|json|byte[]|ballerina/io:0.5.0:ReadableByteChannel|ballerina/mime:1.0.0:Entity[])> ())
-
An HTTP outbound request message or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
, ormime:Entity[]
-
Return Type
(Response | ClientError) An
http:Response
message, or else anhttp:ClientError
if the invocation fails
The RetryClient.get()
function wraps the underlying HTTP remote function in a way to provide
retrying functionality for a given endpoint to recover from network level failures.
Parameters
- path string
-
Resource path
- message RequestMessage (default <(ballerina/http:1.0.0:Request|string|xml|json|byte[]|ballerina/io:0.5.0:ReadableByteChannel|ballerina/mime:1.0.0:Entity[])> ())
-
An HTTP outbound request message or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
, ormime:Entity[]
-
Return Type
(Response | ClientError) An
http:Response
message or else anhttp:ClientError
if the invocation fails
The RetryClient.options()
function wraps the underlying HTTP remote function in a way to provide
retrying functionality for a given endpoint to recover from network level failures.
Parameters
- path string
-
Resource path
- message RequestMessage (default <(ballerina/http:1.0.0:Request|string|xml|json|byte[]|ballerina/io:0.5.0:ReadableByteChannel|ballerina/mime:1.0.0:Entity[])> ())
-
An HTTP outbound request message or any payload of type
string
,xml
,json
,byte[]
,io:ReadableByteChannel
, ormime:Entity[]
-
Return Type
(Response | ClientError) An
http:Response
message or else anhttp:ClientError
if the invocation fails
Submits an HTTP request to a service with the specified HTTP verb.
The RetryClient.submit()
function does not give out a http: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
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 anhttp:ClientError
if the invocation fails
Checks whether an http:PushPromise
exists for a previously-submitted request.
Parameters
- httpFuture HttpFuture
-
The
http:HttpFuture
related to a previous asynchronous invocation
-
Return Type
(boolean) A
boolean
, which represents whether anhttp:PushPromise
exists
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 anhttp:ClientError
if the invocation fails
Retrieves the promised server push http: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
Rejects an http:PushPromise
.
When an http:PushPromise
is rejected, there is no chance of fetching a promised response using the rejected promise.
Parameters
- promise PushPromise
-
The Push Promise to be rejected