execute
Executes the provided suspendable block of code under the control of the composed resilience policies.
The policies are applied in a specific order, wrapping the execution of the block. The execution order from the outermost to the innermost policy is as follows:
Execution Order (Outer → Inner):
Timeout: Enforces an overall time limit for the entire operation, including all retries.
Retry: Retries the execution if it fails, subject to the retry policy's conditions.
Circuit Breaker: Prevents execution if the circuit is open, failing fast.
Rate Limiter: Delays execution until a permit is available from the rate limiter.
Bulkhead: Restricts concurrent executions, queueing or rejecting if the limit is reached.
Hedging: May trigger secondary, hedged executions if the primary one is slow.
Block: The actual suspendable operation to be executed.
Return
The result of the block if it completes successfully.
Parameters
The suspendable lambda function to execute.
Type Parameters
The return type of the block.
Throws
if the execution fails after all policies have been applied (e.g., all retries failed, or the timeout was exceeded).