Interface IResourceChangeListenerRegistry

All Known Implementing Classes:

This component holds an in-memory list of all registered IResourceChangeListener instances along with their caches and other details needed to maintain those caches. Register an IResourceChangeListener instance with this service to be notified when resources you care about are changed. This service quickly notifies listeners of changes that happened on the local process and also eventually notifies listeners of changes that were made by remote processes.
  • Method Details

    • registerResourceResourceChangeListener

      IResourceChangeListenerCache registerResourceResourceChangeListener(String theResourceName, SearchParameterMap theSearchParameterMap, IResourceChangeListener theResourceChangeListener, long theRemoteRefreshIntervalMs)
      Register a listener in order to be notified whenever a resource matching the provided SearchParameterMap changes in any way. If the change happened on the same jvm process where this registry resides, then the listener will be called within ResourceChangeListenerCacheRefresherImpl.LOCAL_REFRESH_INTERVAL_MS of the change happening. If the change happened on a different jvm process, then the listener will be called within the time specified in theRemoteRefreshIntervalMs parameter.
      theResourceName - the type of the resource the listener should be notified about (e.g. "Subscription" or "SearchParameter")
      theSearchParameterMap - the listener will only be notified of changes to resources that match this map
      theResourceChangeListener - the listener that will be called whenever resource changes are detected
      theRemoteRefreshIntervalMs - the number of milliseconds between checking the database for changed resources that match the search parameter map
      RegisteredResourceChangeListener a handle to the created cache that can be used to manually refresh the cache if required
      DataFormatException - if theResourceName is not a valid resource type in the FhirContext
      IllegalArgumentException - if theSearchParamMap cannot be evaluated in-memory
    • unregisterResourceResourceChangeListener

      Unregister a listener from this service
      theResourceChangeListener -
    • unregisterResourceResourceChangeListener

      Unregister a listener from this service using its cache handle
      theResourceChangeListenerCache -
    • clearListenersForUnitTest

    • contains

      theCache -
      true if theCache is registered
    • requestRefreshIfWatching

      void requestRefreshIfWatching(org.hl7.fhir.instance.model.api.IBaseResource theResource)
      Called by the ResourceChangeListenerRegistryInterceptor when a resource is changed to invalidate matching caches so their listeners are notified the next time the caches are refreshed.
      theResource - the resource that changed that might trigger a refresh
    • getWatchedResourceNames

      a set of resource names watched by the registered listeners