ResiliencePolicyOptions
Defined in: packages/pipeline-resilience/src/interfaces/resilience-options.interface.ts:231
A named policy for an outbound dependency, declared once in
new ResiliencePolicies({ ... }) and shared by every caller through
ResiliencePolicies or @InjectResiliencePolicy(name).
It wraps one outbound call, not a handler, so it offers every layer —
a circuit breaker per dependency, a fallback value for one call — and needs
no replaySafe acknowledgment: the adapter retries only its own call.
Retry, circuit breaker and fallback still require handle(error) or
handleAllErrors: true.
Example
Section titled “Example”A payment API shared by several handlers
new ResiliencePolicies({ paymentsApi: { handle: (error) => error instanceof PaymentGatewayUnavailableError, retry: { maxAttempts: 2, backoff: { type: 'exponential' } }, circuitBreaker: { halfOpenAfter: 30_000, breaker: { type: 'consecutive', threshold: 5 } }, timeout: { duration: 3_000, strategy: 'cooperative' }, },});Properties
Section titled “Properties”bulkhead?
Section titled “bulkhead?”
optionalbulkhead?:BulkheadOptions
Defined in: packages/pipeline-resilience/src/interfaces/resilience-options.interface.ts:237
Concurrency limit, shared by every caller of the policy.
circuitBreaker?
Section titled “circuitBreaker?”
optionalcircuitBreaker?:CircuitBreakerOptions
Defined in: packages/pipeline-resilience/src/interfaces/resilience-options.interface.ts:235
Circuit breaker, shared by every caller of the policy.
fallback?
Section titled “fallback?”
optionalfallback?:FallbackOptions
Defined in: packages/pipeline-resilience/src/interfaces/resilience-options.interface.ts:241
Value returned in place of a handled failure.
handle?
Section titled “handle?”
optionalhandle?: (error) =>boolean
Defined in: packages/pipeline-resilience/src/interfaces/resilience-options.interface.ts:243
Selects the errors retry, circuit breaker and fallback act on.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
handleAllErrors?
Section titled “handleAllErrors?”
optionalhandleAllErrors?:boolean
Defined in: packages/pipeline-resilience/src/interfaces/resilience-options.interface.ts:245
Acts on every error; set it only deliberately.
order?
Section titled “order?”
optionalorder?:ResilienceLayer[]
Defined in: packages/pipeline-resilience/src/interfaces/resilience-options.interface.ts:251
Composition order, outermost first.
Default
Section titled “Default”['fallback', 'retry', 'circuitBreaker', 'bulkhead', 'timeout']retry?
Section titled “retry?”
optionalretry?:RetryPolicyOptions
Defined in: packages/pipeline-resilience/src/interfaces/resilience-options.interface.ts:233
Retry the call.
telemetry?
Section titled “telemetry?”
optionaltelemetry?:ResilienceTelemetry
Defined in: packages/pipeline-resilience/src/interfaces/resilience-options.interface.ts:253
Telemetry hooks; every event carries the policy name.
timeout?
Section titled “timeout?”
optionaltimeout?:TimeoutPolicyOptions
Defined in: packages/pipeline-resilience/src/interfaces/resilience-options.interface.ts:239
Timeout of one call.