FHIR Chat · Intercepting outgoing Subscription requests · hapi

Stream: hapi

Topic: Intercepting outgoing Subscription requests


view this post on Zulip Joris Scharp (Nov 23 2021 at 13:24):

Hi all,

I was wondering if it's possible to intercept outgoing Subscription calls before they are sent. So that I can execute logic that decides whether the notification is sent or not.

Some context: We apply search narrowing based on a given authorization. We also want to apply this logic runtime to calculate if the given Subscription should execute. We could also modify the Subscription.criteria on save. But we'd need to keep changing it as the authorizations change. If the above isn't possible in HAPI, deciding between the two options will be easy!

view this post on Zulip Joel Schneider (Nov 23 2021 at 15:38):

HAPI has an interceptor framework for doing this kind of thing. Here's a link to some documentation on server pointcuts.
https://hapifhir.io/hapi-fhir/docs/interceptors/server_pointcuts.html

view this post on Zulip Joris Scharp (Nov 24 2021 at 08:11):

I know about the primary interceptor hooks. But as far as I know, this is always based on an incoming request, which is not directly the case for sending a notification to existing Subscription resources right? Say someone executes a PUT on a Patient resource, I don't see any hook that lets me inject logic on whether to or not to send the notification based on Subscription.criteria that matches the updated Patient resource.

view this post on Zulip Joel Schneider (Nov 24 2021 at 08:34):

I can't really speak to the subscription story, but the javadoc for the PointCut enum includes a bunch of SUBSCRIPTION_xxx values.
https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/interceptor/api/Pointcut.html

view this post on Zulip Joris Scharp (Nov 24 2021 at 10:58):

Ah that's interesting @Joel Schneider, thanks! I see some promissing Pointcuts.

I see a lot more hook types than shown in the server pointcuts diagrams. It would be great if HAPI could add all server hook types to https://hapifhir.io/hapi-fhir/docs/interceptors/server_pointcuts.html, much easier to find that way!


Last updated: Apr 12 2022 at 19:14 UTC