Trace gateway queue capacity, poison messages and replay
Apply a bounded queue, transformation contract, duplicate filter, dead-letter route and replay to a supplied fictional event fixture.

Use the Integration and Gateways message-queuing route to inspect how a bridge maps source records, preserves meaning and handles failures.
Predict the reading, then compare it with the measurement.
Python 3 in your browser (JupyterLite)
Python · no installApply a bounded queue, transformation contract, duplicate filter, dead-letter route and replay to a supplied fictional event fixture.
Open the notebook in your browser and run each Python cell; no install or account is needed.
Three ways to run: use JupyterLite here with no install; run main.py locally from the downloadable lab folder; or open the same notebook in Google Colab.
Steps
Step 1
- Do
- In the notebook editor, run the Step 1 notebook cell. Freeze and hash the fictional source-event fixture.
- You will see
- The run prints six events including a duplicate e2 and malformed e3, plus a SHA-256 prefix.
- Why it matters
- A replay result needs a fixed source input.

Step 1 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 2
- Do
- In the notebook editor, run the Step 2 notebook cell. Fill a capacity-three intake queue.
- You will see
- The fourth event e3 meets backpressure; draining e1 frees a slot.
- Why it matters
- Capacity pressure needs an explicit admission policy.

Step 2 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 3
- Do
- In the notebook editor, run the Step 3 notebook cell. Validate and deduplicate the six events.
- You will see
- The output marks e2 duplicate and e3 dead-letter while accepting e1, e2, e4 and e5.
- Why it matters
- Bad records must not block later valid records.

Step 3 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 4
- Do
- In the notebook editor, run the Step 4 notebook cell. Translate accepted meter records.
- You will see
- The output maps e1 to plant/meter-a/power with watts 120 and unit W.
- Why it matters
- A reviewable bridge specifies target topic, unit and idempotency key.

Step 4 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 5
- Do
- In the notebook editor, run the Step 5 notebook cell. Quarantine the poison record.
- You will see
- The dead-letter entry says id=e3 reason=invalid_watts attempts=1.
- Why it matters
- Unbounded retries of malformed input cause queue failure.

Step 5 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 6
- Do
- In the notebook editor, run the Step 6 notebook cell. Replay the corrected event once.
- You will see
- The run reports five unique accepted IDs after correction, one duplicate and one repaired dead letter.
- Why it matters
- Replay must preserve identity and show reconciliation counts.

Step 6 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab)
Chapter checks
These questions refer to the chapter’s examples. Use the return links to review their answers.
A bridge has a retained command and a rejected message. What two failure paths need explicit policy?
Return to the chapter’s knowledge checkA team sets the highest QoS so that each command runs exactly once across the whole pipeline. Why is QoS alone not sufficient?
Return to the chapter’s knowledge check