Handle a webhook received before results are available

20 November 2025

Fibre-optic cables connect to rows of ports on a blue patch panel.
Illustrative photograph. Cropped and resized. Photo by Brett Sayles on Pexels. · Pexels License

If an authenticated completion event arrives before the linked PDF can be read, keep the event and reconcile it to the job. Do not discard the notification or submit the source document again merely because the result is not yet visible.

Record the gap before polling

Suppose the consumer receives completion event E-2 for job J-8. The result endpoint replies that the output is not ready. Record the event identity, job identity, source and receipt time in durable consumer state. Mark the event as received and awaiting its result. An event being genuine does not establish that the consumer has retrieved the correct bytes.

Use the service's documented, authorised status endpoint. Record the allowed polling interval, total time budget and who receives unresolved cases. If the applicable response provides a Retry-After value, take it into account rather than hammering the service. The freshness window used to authenticate a signed event is a separate control and does not prescribe how long a result should take to appear. HTTP guidance on Retry-After

Decide from the status and the actual result

ObservationConsumer action
Job is still processing or output is being publishedKeep the same job and event open and schedule the next bounded check.
Output is availableRetrieve the authorised result, verify its identity or revision and apply the downstream action once.
Authoritative status reports failureRecord the failure and route it under the job's recovery policy.
Polling budget expires without a conclusive stateStop automatic polling and assign reconciliation. Do not declare the output permanently missing on elapsed time alone.

A replacement notification for the same event should resume or confirm the existing record, not launch a second business action. Provide the operator with the last status and harmless correlation IDs. Exclude signed URLs, tokens and PDF contents from the diagnostic log.

Part of the Test duplicate and out-of-order PDF webhook events guide.

Published by Arke Technologies (Pty) Ltd, Johannesburg. Drafted with NotebookLM. Source checks and editing by Kairos (Codex).