Courseiva

Exactly-Once Processing

You are designing a solution that processes orders from an e-commerce website. The solution must guarantee that each order is processed exactly once. Which TWO Azure services can you use to achieve this requirement?

Quick Answer

The answer is Azure Service Bus and Azure Event Hubs. Service Bus achieves exactly-once message processing through its built-in duplicate detection feature, which identifies and discards duplicate messages based on a unique message ID within a defined time window, while its message sessions ensure ordered delivery. Event Hubs, when combined with idempotent consumer logic and checkpointing via consumer groups, can also guarantee exactly-once semantics by tracking the last successfully processed offset and preventing reprocessing. On the AZ-204 exam, this question tests your understanding of messaging guarantees, with a common trap being to confuse Event Grid’s at-least-once delivery or Azure Storage Queues’ lack of deduplication with true exactly-once processing. Remember that Service Bus gives you explicit duplicate detection, while Event Hubs requires you to build idempotency into your consumer—think of it as “Service Bus does the work for you, Event Hubs trusts you to do it yourself.”

⚠ Common exam trap

It's easy for candidates to confuse 'at-least-once' delivery (which Azure Storage Queues and Event Grid provide) with 'exactly-once' delivery, or they incorrectly assume that any queue-based service inherently guarantees exactly-once processing without considering the specific mechanisms like duplicate detection or checkpointing.

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

Azure Service Bus

Azure Service Bus supports sessions and message deferral, which enable exactly-once processing by ensuring that a message is not removed from the queue until the consumer explicitly completes it after successful processing. If the consumer fails, the message becomes visible again, preventing duplicate processing. This guarantee is achieved through the Peek-Lock receive mode and the use of duplicate detection, which automatically discards duplicate messages within a defined time window.

Answer analysis

Option-by-option breakdown

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

  • Azure Service Bus

    Why this is correct

    Service Bus supports duplicate detection for exactly-once.

  • Azure Storage Queues

    Why it's wrong here

    Storage queues do not guarantee exactly-once.

  • Azure Event Grid

    Why it's wrong here

    Event Grid guarantees at-least-once delivery.

  • Azure Cache for Redis

    Why it's wrong here

    Not a messaging service.

  • Azure Event Hubs

    Why this is correct

    Event Hubs with checkpointing can achieve exactly-once.

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

Same concept, more angles

1 more way this is tested on AZ-204

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. You are building a solution that processes orders from multiple regions. Orders must be processed in the order they are received, but processing can take up to 5 minutes. You need to ensure exactly-once processing and minimize latency. Which Azure service and configuration should you use?

hard
  • A.Azure Service Bus Queue with sessions enabled
  • B.Azure Event Hubs with consumer groups
  • C.Azure Service Bus Queue with duplicate detection enabled
  • D.Azure Queue Storage with poison messages

Why A: Azure Service Bus Queue with sessions enabled ensures FIFO (first-in-first-out) ordering and exactly-once processing by grouping related messages into sessions. Sessions guarantee that messages within a session are processed in order, and the lock mechanism prevents duplicate processing even if processing takes up to 5 minutes. This minimizes latency by avoiding the overhead of duplicate detection or consumer group coordination.

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.