Cloud
Azure Event Hubs: qualify an out-of-retention checkpoint before resuming
A production runbook for bounding missing events, checking a Capture archive and restarting a consumer without hiding data loss.
After a prolonged outage, an Event Hubs consumer restarts with a checkpoint older than the events still available. Starting at the latest position can restore a live stream while hiding a gap. Starting at the oldest available position does not recover events that have already expired either.
Consider an AMQP application that processes events by partition, stores checkpoints externally and writes to a business database. Its event hub uses time-based delete retention. The goal is to separate readable events, already committed effects and a potentially lost interval before choosing a controlled restart. This procedure is not for a compacted stream.
Preserve evidence and define scope
Pause automatic restarts and manual checkpoint edits for the affected consumer. Preserve a protected copy of its state without modifying active leases or checkpoints. Record the identity, group, application version and checkpoint-store configuration. AMQP checkpoints are the consumer’s responsibility, not an Event Hubs service checkpoint. Other groups can read independently; assess their impact before stopping them.
For each partition, record the durable checkpoint, last confirmed business transaction, oldest readable position and associated timestamps, including collection method and time. Positions are comparable within a partition. An old checkpoint alone does not prove loss: processing may have progressed after it was written. Conversely, missing logs do not prove that an effect is missing.
partition | checkpoint | last confirmed effect | available start | interval to investigate
0 | <sequence> | <sequence / evidence> | <sequence> | <bounds>
1 | <sequence> | <sequence / evidence> | <sequence> | <bounds>
For every boundary: UTC time, source, collection time and uncertainty.
Also preserve: configured retention, version, errors, Capture state and destination.
Keep sensitive event data out of the incident record. Retention continues to expire during the investigation. Assess urgency per partition and consult the business owner before changing the policy. Increasing retention cannot resurrect events already deleted. Check tier limits and applicable behavior before making a change.
Establish what can still be recovered
Compare the checkpoint and confirmed effects with the first available position. If the required events remain in the stream, an isolated bounded read may be enough. If the interval predates that position, it is no longer available from the stream. Record the uncertain interval and business impact rather than calling it recovered.
Check whether Event Hubs Capture was enabled before and throughout the interval, then inspect destination files, partitions, times, access and delivery errors. Capture archives received events; enabling it now cannot reconstruct expired history. A file’s presence alone does not prove complete coverage: compare its metadata and contents with the expected boundaries, accounting for empty windows and the configured format. If coverage remains uncertain, look for an authorized producer or business source and have its owner assess the gap.
Sequences and offsets belong to a stream partition. An approximate timestamp alone does not establish an exact boundary. Record possible overlaps and gaps; do not subtract offsets from different partitions to count missing events.
Prepare an isolated recovery
Do not move the production checkpoint to investigate. Use a separate consumer group and checkpoint store, or an isolated archive reader, with a read-only identity. Disable business effects on the first pass. Set an inclusive start, explicit end, rate limit and stop condition for each partition; the reader must enforce its own end boundary.
incident: <id>
source: <event-hub-or-capture-archive>
recovery_group: <dedicated-group>
checkpoint_store: <isolated-store>
partitions:
- id: "0"
start_inclusive: <verified-position>
stop: <explicit-position-and-inclusion-rule>
effects: dry-run
max_rate: <approved-limit>
stop_on: [unexpected_duplicate, missing_range, downstream_errors]
owner: <operator>
approval: <business-owner-and-change-reference> This plan is an execution contract, not native Event Hubs configuration. First test a small known interval: count reads, skips and failures; compare business identifiers, expected outcomes and coverage. Leave capacity for live traffic. Stop the reader and preserve its log if an unexplained gap, unexpected effect or downstream pressure appears.
Reconcile before writing
A replay can repeat transactions completed after the last checkpoint. Match business identifiers to durable effects, including partial transactions and external calls. An idempotency key helps only if the write boundary actually enforces it and retains it long enough. Without that guarantee, prepare an approved business correction; do not assume a replay is safe.
Have the owner approve the missing effects and unresolved exceptions. Apply a small canary with destination-side controls, reconcile its results, then expand. Do not mix archived and live events without an explicit deduplication and ordering policy. If a range cannot be recovered, the restart decision must state the gap, impact and accountable owner.
Decide, validate and stop
Resume the normal consumer only after documenting the chosen start position for each partition, using the actual SDK and checkpoint store. Preserve the previous state and test restart in isolation: behavior when a requested position has expired depends on the client and its configuration. Then verify progress, checkpoints, event age and business effects over several windows. Missing telemetry is not evidence of zero lag.
If the canary diverges, stop recovery and restore the known consumer version and settings without blindly restoring an expired checkpoint. Configuration rollback does not undo writes already made: identify them and use an approved compensation procedure. Close only after partition-level reconciliation, explicit acceptance or correction of gaps, and an alert on progress age relative to retention.