Invocation
public class Invocation<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.
-
Arguments for circuit command.
Declaration
Swift
public let commandArgs: A -
Arguments for circuit fallback.
Declaration
Swift
public let fallbackArgs: B -
Invocation initializer.
Declaration
Swift
public init(startTime: Date, breaker: CircuitBreaker<A, B>, commandArgs: A, fallbackArgs: B)Parameters
startTimeThe startTime for
Invocation.breakerCircuitBreaker instance.
commandArgsArguments of type
Afor the command context.fallbackArgsArguments of type
Bfor the circuit fallback. -
Marks invocation as having timed out if and only if the execution of the invocation has not completed yet. In such case, true is returned; otherwise, false.
Usage Example:
result = invocation.notifyTimedOut()Declaration
Swift
public func notifyTimedOut() -> Bool -
Notifies the circuit breaker of success if a timeout has not already been triggered.
Usage Example:
invocation.notifySuccess()Declaration
Swift
public func notifySuccess() -
Notifies the circuit breaker of failure if a timeout has not already been triggered.
Usage Example:
The example below notifies the circuit breaker of a predefined encodingURLError.
invocation.notifyFailure(error: .encodingURLError)Declaration
Swift
public func notifyFailure(error: BreakerError)Parameters
errorThe corresponding error msg.
View on GitHub
Invocation Class Reference