Capture a feed you can replay
A parcel carrier polls a paginated partner API and also receives scanner events.
Capture a feed you can replay
A parcel carrier polls a paginated partner API and also receives scanner events. Persist the page cursor only after its records are durable. Honor the partner's retry interval and retain an event identifier across attempts. On Kinesis, partition by a key that distributes writes while preserving the order a consumer actually needs. Two independent consumers may need their own read throughput and checkpoints.
Decisions to rehearse
- Durable consumer checkpoint
- A committed position lets a reader resume after its last successful sink write.
- Bounded exponential backoff with jitter
- Spreading retries reduces synchronized calls while respecting the upstream quota.
- Enhanced fan-out
- Each registered Kinesis consumer receives dedicated read throughput per shard.
- S3 object-created event
- Object completion can start a file-specific workflow without polling the entire bucket.
- A conditional write keyed by event ID
- A sink that recognizes previously applied events can safely receive the same record twice.
- A scheduled batch extract
- A scheduled pull fits a source that publishes one fixed snapshot and exposes no change feed.
Practise each AWS skill
These references use the skill numbers in the AWS guide.
- 1.1.1 · Compare Kinesis, MSK and a database change stream for a reader that must resume yesterday's position.
- 1.1.2 · Choose a nightly full extract, a DMS snapshot plus CDC or a file batch, given the source's change contract.
- 1.1.3 · Set an input prefix, split size and concurrency for a partitioned batch. Measure source pressure before raising parallelism.
- 1.1.4 · Follow a paginated partner response through its last continuation token and store the raw response identifier.
- 1.1.5 · Schedule a daily crawler after file delivery; decide what should happen when delivery is late.
- 1.1.6 · Trigger on the completed manifest, not on the first piece of a multipart delivery. Make repeated triggers harmless.
- 1.1.7 · Trace a Kinesis batch to its Lambda event source mapping and predict the result of a partial processing failure.
- 1.1.8 · Choose a stable egress IP and verify it against the upstream allowlist before troubleshooting application credentials.
- 1.1.9 · Honor returned retry limits and bound retries so a delayed source cannot overwhelm another destination.
- 1.1.10 · Separate combining many producers into a stream from giving independent consumers their own read throughput.
- 1.1.11 · Restart from a prior position, compare final totals and explain how retention constrains the replay window.
- 1.1.12 · Compare field projection with a running account balance. Identify the state and key the second operation must retain.
Official skills for this topic
Work through the decision
An API lists pages 41 and 42. Page 41 reached the ledger, but saving its cursor failed. A second reader is already processing scanner events. Which state belongs to which reader, and when should the API cursor move?
Check your reasoning
Give each consumer its own position. Re-fetch page 41 and apply stable event IDs at the sink. Save the API cursor after that write succeeds. Adding read throughput for scanner consumers changes capacity and leaves the API commit order to the application.
Related recording chapters: 10:33.
Replay a partially delivered batch
15:35 · Replay and retained records. Listen for what makes an earlier stream range readable again. In the lab, the separate question is whether applying that range twice changes the ledger.
A scanner has resent one message and reused the same parcel ID for a second real event. Predict the count and total if the sink deduplicates by event ID. Change the key to parcel ID and explain the lost update. Run with Python 3 and its standard library.
import sqlite3
db = sqlite3.connect(":memory:")
db.execute("CREATE TABLE ledger (event TEXT PRIMARY KEY, parcel TEXT, delta INTEGER)")
batch = [("e1", "p1", 4), ("e1", "p1", 4), ("e2", "p1", -1)]
for delivery in (batch[:1], batch):
with db:
db.executemany("INSERT OR IGNORE INTO ledger VALUES (?, ?, ?)", delivery)
print(db.execute("SELECT COUNT(*), SUM(delta) FROM ledger").fetchone())
Check the result
(2, 3)
The first message survives both retries. The later adjustment has a different event ID and must also survive. A parcel key would discard the adjustment.
Related lesson in Fabric Data Engineer Associate · Load new and changed records safely.
Capture a feed you can replay quiz
Answer 3 questions. Check each answer for an explanation.