Classes

The following classes are available globally.

  • CircuitBreaker enables you to use Circuit Breaker logic in your Swift applications.

    • A: Parameter types used in the arguments for the command closure.
    • B: Parameter type used as the second argument for the fallback closure.

    Usage Example:

    The example below shows how to create a CircuitBreaker instance for each context function (e.g. endpoint) you wish to circuit break. You need to give the CircuitBreaker instance a name, create a context function for the endpoint you intend to circuit break (myContextFunction in the example below) and define a fallback function (myFallback in the example below) to call if there are timeouts or user defined failures occur.

    let breaker = CircuitBreaker(name: "Circuit1", command: myContextFunction, fallback: myFallback)
    

    For a more complete example see the CircuitBreaker README.

    See more

    Declaration

    Swift

    public class CircuitBreaker<A, B>
  • Invocation entity. A context function receives an Invocation object as its parameter. The Invocation object allows you to notify the circuit breaker of success or failure, provided that a timeout has not already been triggered.

    See more

    Declaration

    Swift

    public class Invocation<A, B>
  • Circuit Breaker statistics.

    See more

    Declaration

    Swift

    public class Stats