Courseiva
Develop Azure compute solutionshardMultiple ChoiceObjective-mapped

AZ-204 Develop Azure compute solutions Practice Question

You are implementing an Azure Durable Functions orchestration. The orchestration calls several activity functions that may fail transiently. You need to retry an activity up to 3 times with a 5-second delay, doubling the delay each time (exponential backoff). Which method should you use to call the activity?

⚠ Common exam trap

A common mix-up: candidates think manual retry logic (Option A) is acceptable, but Durable Functions orchestrators must be deterministic and cannot use custom retry loops that introduce non-deterministic behavior like random delays or external state.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

CallActivityWithRetryAsync with RetryOptions(maxAttempts: 3, firstRetryInterval: TimeSpan.FromSeconds(5), backoffCoefficient: 2)

`CallActivityWithRetryAsync` is the built-in method in Durable Functions for calling activity functions with automatic retry policies, including exponential backoff. The `RetryOptions` object allows you to specify `maxAttempts` (3), `firstRetryInterval` (5 seconds), and `backoffCoefficient` (2) to double the delay each time, exactly matching the requirement without custom code.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • CallActivityAsync with a try-catch loop that implements retry logic

    Why it's wrong here

    A manually written try-catch loop with `CallActivityAsync` lacks the built-in exponential backoff and retry count enforcement that the Durable Functions `CallActivityWithRetryAsync` method provides. The stem requires doubling the delay after each of up to three retries, which would demand custom timer logic and state management in a loop. This approach is tempting because `CallActivityAsync` is the standard method for invoking activity functions without retry concerns, and a try-catch loop is a natural pattern for handling transient failures in synchronous code. It would be correct only if the requirement were a simple, non-exponential retry with a fixed delay, where manual implementation is acceptable.

  • CallActivityWithRetryAsync with RetryOptions(maxAttempts: 3, firstRetryInterval: TimeSpan.FromSeconds(5), backoffCoefficient: 2)

    Why this is correct

    The `CallActivityWithRetryAsync` method is the native and most robust way to implement retry logic for activity function calls within a Durable Functions orchestration. By utilizing `RetryOptions`, developers can declaratively specify the exact retry policy, including `maxAttempts`, `firstRetryInterval`, and `backoffCoefficient`, which directly maps to the requirement of 3 attempts with an initial 5-second delay that doubles exponentially. This approach leverages Durable Functions' built-in state management and reliability features, ensuring that the retry logic persists across orchestrator rehydrations and host restarts without manual state tracking.

  • Use a timer trigger to schedule retries after failure

    Why it's wrong here

    Using a timer trigger to schedule retries after an activity failure is an inappropriate and overly complex solution for Durable Functions orchestrations. Timer triggers are designed to initiate new function executions on a predefined schedule, not to manage internal retry logic for specific failed operations within an ongoing orchestration instance. Implementing this would require external state management to track which activity failed, how many times it has been retried, and to correlate the timer-triggered function back to the specific orchestration instance, thereby undermining the inherent reliability and statefulness provided by Durable Functions.

  • Set the activity function's retry policy in the function.json file

    Why it's wrong here

    Setting an activity function's retry policy in its `function.json` file is incorrect because `function.json` primarily defines the bindings, triggers, and metadata for a single function's execution context, not its invocation behavior when called by an orchestrator. Retry policies for activity functions are a concern of the *orchestrator client* (the orchestration function itself) that invokes the activity, not the activity function's own definition. The `function.json` schema does not support defining retry policies for activity functions, as this logic is handled at the orchestration level via methods like `CallActivityWithRetryAsync`.

Visual reference

Client Server SYN (seq=100) SYN-ACK (seq=200, ack=101) ACK (ack=201) Connection established — data transfer begins

About these practice questions

One of 881 original AZ-204 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.