Skip to main content

Module jobs

Module jobs 

Source
Expand description

The FHIR Asynchronous Request Pattern (https://hl7.org/fhir/R4/async.html, and the Bulk Data IG’s version of it): a request answered with 202 Accepted and a Content-Location to poll, where the client reads 202 with X-Progress and Retry-After while the work runs, then the result, or an error with an OperationOutcome, and can DELETE the location to cancel.

The work itself is an async_jobs row run by haste-health worker (see haste_worker::async_jobs). This module is the HTTP side: the status URL, the status and cancel endpoints, and the Prefer header that asks for the pattern. operation is the first kind of job: an operation invoked with Prefer: respond-async.

Modules§

operation
The operation kind of job: an operation invoked with Prefer: respond-async, run later by the worker exactly as the request would have run it (the same client, middleware, scopes and access policies, from the submitter’s stored claims), with the resource it returns served as the job’s result.

Structs§

JobPath

Constants§

RESPOND_ASYNC
The Prefer token that asks for the asynchronous pattern.

Functions§

cancel_handler
DELETE of the status URL: cancels the job, or, once it has finished, gives up its result. 202 Accepted either way; 404 if there is no such job or it was already cancelled.
prefers_async
Whether the request’s Prefer header(s) carry respond-async. The header is a comma-separated list of preferences (respond-async, return=minimal) and may be repeated.
status_handler
GET of the status URL.
status_url
The absolute URL the client polls for a job: sibling of the project’s FHIR root, so the same token authorizes it, but outside the FHIR routes since neither its response codes nor its bodies are FHIR interactions.