Package ca.uhn.fhir.jpa.topic
Class SubscriptionTopicDispatcher
java.lang.Object
ca.uhn.fhir.jpa.topic.SubscriptionTopicDispatcher
Subscription topic notifications are natively supported in R5, R4B. They are also partially supported and in R4
via the subscription backport spec Subscription Backport.
In all versions, it is possible for a FHIR Repository to submit topic subscription notifications triggered by some
arbitrary "business event". In R5 and R4B most subscription topic notifications will be triggered by a SubscriptionTopic
match. However, in the R4 backport, the SubscriptionTopic is not supported and the SubscriptionTopicDispatcher service
is provided to generate those notifications instead. Any custom java extension to the FHIR repository can @Autowire this service to
send topic notifications to all Subscription resources subscribed to that topic.
-
Constructor Summary
ConstructorDescriptionSubscriptionTopicDispatcher
(ca.uhn.fhir.context.FhirContext theFhirContext, SubscriptionRegistry theSubscriptionRegistry, SubscriptionMatchDeliverer theSubscriptionMatchDeliverer, SubscriptionTopicPayloadBuilder theSubscriptionTopicPayloadBuilder) -
Method Summary
Modifier and TypeMethodDescriptionint
dispatch
(SubscriptionTopicDispatchRequest theSubscriptionTopicDispatchRequest) Deliver a Subscription topic notification to all subscriptions for the given topic.int
dispatch
(String theTopicUrl, List<org.hl7.fhir.instance.model.api.IBaseResource> theResources, ca.uhn.fhir.rest.api.RestOperationTypeEnum theRequestType) Deliver a Subscription topic notification to all subscriptions for the given topic.
-
Constructor Details
-
SubscriptionTopicDispatcher
public SubscriptionTopicDispatcher(ca.uhn.fhir.context.FhirContext theFhirContext, SubscriptionRegistry theSubscriptionRegistry, SubscriptionMatchDeliverer theSubscriptionMatchDeliverer, SubscriptionTopicPayloadBuilder theSubscriptionTopicPayloadBuilder)
-
-
Method Details
-
dispatch
public int dispatch(String theTopicUrl, List<org.hl7.fhir.instance.model.api.IBaseResource> theResources, ca.uhn.fhir.rest.api.RestOperationTypeEnum theRequestType) Deliver a Subscription topic notification to all subscriptions for the given topic.- Parameters:
theTopicUrl
- Deliver to subscriptions for this topictheResources
- The list of resources to deliver. The first resource will be the primary "focus" resource per the Subscription documentation. This list should _not_ include the SubscriptionStatus. The SubscriptionStatus will be added as the first element to the delivered bundle. The reason for this is that the SubscriptionStatus needs to reference the subscription ID, which is not known until the bundle is delivered.theRequestType
- The type of request that led to this dispatch. This determines the request type of the bundle entries- Returns:
- The number of subscription notifications that were successfully queued for delivery
-
dispatch
Deliver a Subscription topic notification to all subscriptions for the given topic.- Parameters:
theSubscriptionTopicDispatchRequest
- contains the topic URL, the list of resources to deliver, and the request type- Returns:
- The number of subscription notifications that were successfully queued for delivery
-