Interaction: Heartbeat
The FHIR Heartbeat Interaction is a mechanism used by the Subscription Server to verify the ongoing availability and responsiveness of a Subscriber system that has an active subscription.
Scope
The Subscription Server periodically sends a heartbeat notification (typically an empty or minimal payload) to the Subscriber’s notification endpoint.
The Subscriber is expected to respond with an HTTP 200 OK status, confirming that it is reachable and able to receive notifications.
If the Subscriber fails to respond within a defined timeout or after several retries, the Subscription Server may mark the subscription as inactive or error, depending on its configuration.
If the Subscriber stops receiving a hearbeat from Subscription Service, it needs to send SubscriptionStatus request to investigate the issue.
Interaction Sequence Diagram
Specification
HeartBeat Request
The Subscription Server sends a heartbeat request to Subscriber's endpoint.
`POST [base]/Subscription Endpoint`,
Read Subscription Response
The Subscriver returns a 200 OK HTTP status code.
Example of Get Subscription Interaction
Example Heartbeat Request
HTTP Method:
POST
Headers:
Content-Type: application/fhir+json
Address:
[base]/Subscription Endpoint
HTTP Body contains a HeartBeat Bundle Resource
{ "resourceType": "Bundle", "type": "history", "entry": [ { "resource": { "resourceType": "SubscriptionStatus", "status": "active", "type": "heartbeat", "subscription": { "reference": "Subscription/123" }, "topic": "https://example.org/fhir/SubscriptionTopic/my-topic" } } ] }
Expected Behaviour
Case | Scenario Description | HTTP Status Code | Response Payload |
---|---|---|---|
1 | Subscriber successfully received and processed the heartbeat notification. | HTTP 200 | Retrieved |
2 | Subscriber took too long to respond. | HTTP 408 | Not Retrieved. |
3 | Gateway or service unavailable. | HTTP 500 | Internal Server Error. Returns an OperationOutcome resource indicating an issue. |