Courseiva
Develop Azure compute solutionsmediumMultiple ChoiceObjective-mapped

AZ-204 Develop Azure compute solutions Practice Question

You have an Azure Function app that uses an Event Hubs trigger. The function processes events in batches. You notice that some events are being processed more than once. Which setting should you adjust to minimize duplicate processing?

⚠ Common exam trap

Watch out — candidates often confuse retry policies or batch sizes with the checkpointing mechanism, not realizing that duplicate processing in Event Hubs is typically caused by missing or infrequent checkpointing, not by event handling failures.

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

Enable checkpointing in the function code

Checkpointing in Azure Event Hubs stores the offset of the last successfully processed event in a durable store (e.g., Azure Blob Storage). When the function restarts or scales, it resumes from that checkpoint, preventing reprocessing of already-handled events. Without checkpointing, the default behavior may start from the earliest offset or use the `latest` position, leading to duplicate processing.

Answer analysis

Option-by-option breakdown

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

  • Increase the maxRetries per event

    Why it's wrong here

    Increasing the maxRetries per event configures how many times a single function instance will attempt to process an event or batch if an error occurs during its execution. While this helps with transient failures within a specific invocation, it does not prevent the Event Hubs trigger from delivering the same events to another function instance or re-delivering them to the same instance after a host restart or scale-out event if checkpointing is not properly managed. This setting primarily addresses processing reliability within a single execution attempt, not overall idempotency or "at-most-once" delivery guarantees across the distributed system.

  • Enable checkpointing in the function code

    Why this is correct

    Enabling checkpointing in the function code is crucial for ensuring "at-least-once" processing and preventing duplicate event reprocessing. Checkpointing involves recording the offset of the last successfully processed event for each partition in a durable store, typically Azure Storage. When a function instance restarts, scales out, or a new instance takes over a partition, it retrieves the last checkpointed offset and begins processing events from that point, effectively preventing the re-delivery of already processed events. This mechanism is fundamental for managing distributed Event Hubs consumers.

  • Increase the event batch size

    Why it's wrong here

    Increasing the event batch size means the function processes more events in a single invocation. If a failure occurs after some events in the batch have been processed but before the entire batch is successfully checkpointed, all events in that batch, including those already processed, will be re-delivered. This can significantly increase the number of duplicate events that need to be handled by downstream systems, as the checkpoint will only advance upon successful processing of the entire larger batch.

  • Decrease the prefetch count

    Why it's wrong here

    Decreasing the prefetch count controls how many events the Event Hubs client proactively fetches from the Event Hub partition and buffers locally, awaiting processing. A lower prefetch count can reduce memory consumption and potentially latency for the first event, but it generally reduces overall throughput by increasing the frequency of network calls to fetch new events. This setting has no direct impact on preventing duplicate event processing across function instances or after failures, as it only concerns the client-side buffering strategy.

Quick reference

Azure Blob Storage Tier Comparison

TierStorage CostRetrieval CostLatencyUse Case
HotHighestLowestImmediateActive data, frequent reads
CoolLowerHigherImmediateData accessed < once / month
ColdLower stillHigherImmediateData accessed < once / quarter
ArchiveLowestHighest + rehydration delayHoursLong-term compliance retention

About these practice questions

Courseiva writes every AZ-204 question from scratch — 881 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.