ballerina.net.http.resiliency package
public connector CircuitBreaker ( HttpClient httpClient , float failureThreshold , int resetTimeout )
A Circuit Breaker implementation for to be used with the HTTP client connector to gracefully handle network errors
Parameter Name | Data Type | Description |
---|---|---|
httpClient | HttpClient | The HTTP client connector to be wrapped with the circuit breaker |
failureThreshold | float | The threshold for request failures. When this threshold is crossed, the circuit will trip. The threshold should be a value between 0 and 1. |
resetTimeout | int | The time period to wait before attempting to make another request to the upstream service |
Actions:
-
< CircuitBreaker > delete ( string path , OutRequest request ) ( InResponse , HttpConnectorError )
The DELETE action implementation of the Circuit Breaker. Protects the invocation of the DELETE action of the underlying HTTP client connector.
Parameter Name Data Type Description path string Resource path request OutRequest An OutRequest struct Return Variable Data Type Description InResponse HttpConnectorError -
< CircuitBreaker > execute ( string httpVerb , string path , OutRequest request ) ( InResponse , HttpConnectorError )
Protects the invocation of the Execute action of the underlying HTTP client connector. The Execute action can be used to invoke an HTTP call with the given HTTP verb.
Parameter Name Data Type Description httpVerb string HTTP verb to be used for the request path string Resource path request OutRequest An OutRequest struct Return Variable Data Type Description InResponse HttpConnectorError -
< CircuitBreaker > forward ( string path , InRequest request ) ( InResponse , HttpConnectorError )
Protects the invocation of the Forward action of the underlying HTTP client connector. The Forward action can be used to forward an incoming request to an upstream service as it is.
Parameter Name Data Type Description path string Resource path request InRequest An InRequest struct Return Variable Data Type Description InResponse HttpConnectorError -
< CircuitBreaker > get ( string path , OutRequest request ) ( InResponse , HttpConnectorError )
The GET action implementation of the Circuit Breaker. Protects the invocation of the GET action of the underlying HTTP client connector.
Parameter Name Data Type Description path string Resource path request OutRequest An OutRequest struct Return Variable Data Type Description InResponse HttpConnectorError -
< CircuitBreaker > head ( string path , OutRequest request ) ( InResponse , HttpConnectorError )
The HEAD action implementation of the Circuit Breaker. Protects the invocation of the HEAD action of the underlying HTTP client connector.
Parameter Name Data Type Description path string Resource path request OutRequest An OutRequest struct Return Variable Data Type Description InResponse HttpConnectorError -
< CircuitBreaker > options ( string path , OutRequest request ) ( InResponse , HttpConnectorError )
The OPTIONS action implementation of the Circuit Breaker. Protects the invocation of the OPTIONS action of the underlying HTTP client connector.
Parameter Name Data Type Description path string Resource path request OutRequest An OutRequest struct Return Variable Data Type Description InResponse HttpConnectorError -
< CircuitBreaker > patch ( string path , OutRequest request ) ( InResponse , HttpConnectorError )
The PATCH action implementation of the Circuit Breaker. Protects the invocation of the PATCH action of the underlying HTTP client connector.
Parameter Name Data Type Description path string Resource path request OutRequest An OutRequest struct Return Variable Data Type Description InResponse HttpConnectorError -
< CircuitBreaker > post ( string path , OutRequest request ) ( InResponse , HttpConnectorError )
The POST action implementation of the Circuit Breaker. Protects the invocation of the POST action of the underlying HTTP client connector.
Parameter Name Data Type Description path string Resource path request OutRequest An OutRequest struct Return Variable Data Type Description InResponse HttpConnectorError -
< CircuitBreaker > put ( string path , OutRequest request ) ( InResponse , HttpConnectorError )
The PUT action implementation of the Circuit Breaker. Protects the invocation of the PUT action of the underlying HTTP client connector.
Parameter Name Data Type Description path string Resource path request OutRequest An OutRequest struct Return Variable Data Type Description InResponse HttpConnectorError