circuitbreaker

The circuitbreaker middleware prevents fn invocations in the face of errors.

fnrunner Key

fnrun.middleware/circuitbreaker

Configuration

The following table describes the keys on the configuration object for the circuitbreaker middleware.

KeyTypeDefaultDescription
nameString""The name of the circuit breaker
maxRequestsInteger1The max number of requests to allow through when the circuit breaker is half-open
intervalDuration60sThe period at which the internal counts are cleared
timeoutDuration60sThe duration of the open state before moving into the half-open state

Examples

The following applies a circuit breaker to prevent calling the remote endpoint if it has had several failures in a small window of time.

source: fnrun.source/http
middleware:
  - fnrun.middleware/circuitbreaker:
      name: myBreaker
fn: 
  fnrun.fn/http:
    targetURL: http://example.com/some-endpoint

Edit this page on GitHub