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 , Request request ) ( Response , 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 Request An HTTP Request struct

    Return Variable Data Type Description
    Response
    HttpConnectorError
  • < CircuitBreaker > execute ( string httpVerb , string path , Request request ) ( Response , 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 Request An HTTP Request struct

    Return Variable Data Type Description
    Response
    HttpConnectorError
  • < CircuitBreaker > forward ( string path , Request request ) ( Response , 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 Request An HTTP Request struct

    Return Variable Data Type Description
    Response
    HttpConnectorError
  • < CircuitBreaker > get ( string path , Request request ) ( Response , 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 Request An HTTP Request struct

    Return Variable Data Type Description
    Response
    HttpConnectorError
  • < CircuitBreaker > head ( string path , Request request ) ( Response , 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 Request An HTTP Request struct

    Return Variable Data Type Description
    Response
    HttpConnectorError
  • < CircuitBreaker > options ( string path , Request request ) ( Response , 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 Request An HTTP Request struct

    Return Variable Data Type Description
    Response
    HttpConnectorError
  • < CircuitBreaker > patch ( string path , Request request ) ( Response , 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 Request An HTTP Request struct

    Return Variable Data Type Description
    Response
    HttpConnectorError
  • < CircuitBreaker > post ( string path , Request request ) ( Response , 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 Request An HTTP Request struct

    Return Variable Data Type Description
    Response
    HttpConnectorError
  • < CircuitBreaker > put ( string path , Request request ) ( Response , 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 Request An HTTP Request struct

    Return Variable Data Type Description
    Response
    HttpConnectorError