@dolittle/sdk.resilience
Version:
Dolittle is a decentralized, distributed, event-driven microservice platform built to harness the power of events.
23 lines • 1.19 kB
TypeScript
import { Observable } from 'rxjs';
import { Cancellation } from './Cancellation';
import { RetryOperator } from './RetryOperator';
/**
* Defines a retry policy for observables by passing along the errors that should result in a re-subscription of the original observable.
*/
export declare type RetryPolicy = (errors: Observable<Error>) => Observable<Error>;
/**
* Creates a retry policy from a pipe of operators.
* @param {RetryOperator[]} operators - Operators for the pipe.
* @returns {RetryPolicy} The {@link RetryPolicy} that consist of the combined policies.
*/
export declare function retryPipe(...operators: RetryOperator[]): RetryPolicy;
/**
* Run a {@link Observable<T>} with a {@link RetryPolicy}.
* @template T Type for the observable.
* @param {Observable<T>} source - Observable to retry for.
* @param {RetryPolicy} policy - The policy to apply.
* @param {Cancellation} cancellation - A cancellation.
* @returns {Observable<T>} The {@link Observable<T>} that is automatically retried.
*/
export declare function retryWithPolicy<T>(source: Observable<T>, policy: RetryPolicy, cancellation: Cancellation): Observable<T>;
//# sourceMappingURL=RetryPolicy.d.ts.map