RetryOperation class

Implements the necessary logic to retry operations such as connecting, receiving C2D messages, sending telemetry, twin updates, etc.

Constructors

RetryOperation(string, RetryPolicy, number)

Creates an instance of <xref:azure-iot-common.RetryOperation.>

Methods

retry((opCallback: (err?: Error, result?: any, response?: any) => void) => void, (err?: Error, result?: any, response?: any) => void)

Executes an operation and retries if it fails and the retry policy allows it.

Constructor Details

RetryOperation(string, RetryPolicy, number)

Creates an instance of <xref:azure-iot-common.RetryOperation.>

new RetryOperation(name: string, policy: RetryPolicy, maxTimeout: number)

Parameters

name

string

policy
RetryPolicy

The retry policy to be used for this operation, which determines what error is "retryable" or not and how fast to retry.

maxTimeout

number

The maximum timeout for this operation, after which no retry will be attempted.

Method Details

retry((opCallback: (err?: Error, result?: any, response?: any) => void) => void, (err?: Error, result?: any, response?: any) => void)

Executes an operation and retries if it fails and the retry policy allows it.

function retry(operation: (opCallback: (err?: Error, result?: any, response?: any) => void) => void, finalCallback: (err?: Error, result?: any, response?: any) => void)

Parameters

operation

(opCallback: (err?: Error, result?: any, response?: any) => void) => void

The operation to execute.

finalCallback

(err?: Error, result?: any, response?: any) => void

The callback to call with the final error or result, after retries if necessary.