-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Subscription Startup Resiliency
Ken Stevens edited this page Jan 10, 2019
·
11 revisions
There are two ways to perform Subscription Matching using the HAPI-FHIR JPA Server:
- Within a FHIR Server Endpoint using the SubscriptionMatchingInterceptor:
// FHIR Server Config
myDaoConfig.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
myDaoConfig.setSubscriptionMatchingEnabled(true);
mySubscriptionInterceptorLoader.registerInterceptors();
- Outside of the FHIR Server Endpoint using a StandaloneSubscriptionMessageHandler:
// FHIR Server Config
myDaoConfig.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
myDaoConfig.setSubscriptionMatchingEnabled(false);
mySubscriptionInterceptorLoader.registerInterceptors();
In this scenario, you will need to register your own FHIR Server interceptor that sends all Resources to a SubscribableChannel. Then subscribe the StandaloneSubscriptionMessageHandler to that SubcribableChannel within your Message Consumer Server:
// Message Consumer Server Config:
mySubscribableChannel.subscribe(myStandaloneSubscriptionMessageHandler);
In both scenarios, two in-memory registries need to be initialized and kept in-sync with the state of the FHIR Data Repository:
- SearchParamRegistry: The list of active Search Parameters used by the FHIR Server (including custom search params and excluding disabled search params)
- ActiveSubscriptionRegistry: The list of active Subscriptions that will be used to match incoming resources.
The way these are initialized and synchronized works differently in the two scenarios: