Share via


RetryContext Class

  • java.lang.Object
    • com.microsoft.durabletask.RetryContext

public final class RetryContext

Context data that's provided to RetryHandler implementations.

Method Summary

Modifier and Type Method and Description
int getLastAttemptNumber()

Gets the previous retry attempt number.

FailureDetails getLastFailure()

Gets the details of the previous task failure, including the exception type, message, and callstack.

TaskOrchestrationContext getOrchestrationContext()

Gets the context of the current orchestration.

java.time.Duration getTotalRetryTime()

Gets the total amount of time spent in a retry loop for the current task.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Method Details

getLastAttemptNumber

public int getLastAttemptNumber()

Gets the previous retry attempt number. This number starts at 1 and increments each time the retry handler is invoked for a particular task failure.

Returns:

the previous retry attempt number

getLastFailure

public FailureDetails getLastFailure()

Gets the details of the previous task failure, including the exception type, message, and callstack.

Returns:

the details of the previous task failure

getOrchestrationContext

public TaskOrchestrationContext getOrchestrationContext()

Gets the context of the current orchestration.

The orchestration context can be used in retry handlers to schedule timers (via the TaskOrchestrationContext#createTimer methods) for implementing delays between retries. It can also be used to implement time-based retry logic by using the TaskOrchestrationContext#getCurrentInstant method.

Returns:

the context of the parent orchestration

getTotalRetryTime

public Duration getTotalRetryTime()

Gets the total amount of time spent in a retry loop for the current task.

Returns:

the total amount of time spent in a retry loop for the current task

Applies to