Tutorial: Subscribe to Topic (/R4B)
Last updated
Was this helpful?
Last updated
Was this helpful?
While FHIR topic-based subscriptions are functional, they will no longer receive active development or new features. For enhanced capabilities and ongoing support, please use . This newer implementation offers improved performance, flexibility, and will continue to be developed to meet future needs.
This tutorial requires configuring your Aidbox instance with a specific SubscriptionTopic for Observation resource. Additionally, a web service that will receive rest-hook
notifications is required. This contains a suitable template project, which should be used for this tutorial.
Use FHIR API to discover available topics. Each topic contains URL
field which should be specified as a criteria
field of Subscription.
In response, one configured topic is available, with "url": "http://aidbox.app/SubscriptionTopic/observations"
.
Create a Subscription resource with all the necessary attributes.
Profile http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-subscription
is required for R4B.
Most interesting part are:
"criteria" : "http://aidbox.app/SubscriptionTopic/observations"
- the Topic that a subscription are created for.
{"url" : "http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-max-count", "valuePositiveInt" : 2}
notification will be delivered immediately when specified number of suitable events is met.
{"url" : "http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-heartbeat-period", valueUnsignedInt" : 20}
period in seconds when all available to the moment messages will be delivered. if no messages collected - heartbeat event will be fired.
{"url" : "http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-payload-content", "valueCode" : "id-only"}
notification will only contain ids of resources. The other options are full-resource
and empty
.
"endpoint" : "http://subscription-demo-server:9000/callback-test-1"
endpoint to which POST
request with notifications will be sent.
{"url" : "http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-filter-criteria", "valueString" : "Observation?value=42"}
specifies, that only observation with value=42
should be delivered for this notification. Available filters or resources may be configured in SubscriptionTopic.
As a result of this step Aidbox will try to perform a handshake with the subscriber service. By default Aidbox expects Status:200
response.
You may notice handshake
event in demo server UI:
After the successful handshake, the status of the Subscription will be active
.