Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support using a single FhirContext to talk to multiple servers that might require different proxy configuration #6390

Open
MFAshby opened this issue Oct 21, 2024 · 0 comments

Comments

@MFAshby
Copy link
Contributor

MFAshby commented Oct 21, 2024

Describe the issue
In order to use an http proxy with HAPI; one has to supply the proxy details to the FhirContext, e.g.

var ctx = FhirContext.forDstu3();
ctx.getRestfulClientFactory().setProxy("myProxyHost", 1234);

Then any clients created from that context will use the same proxy details

var fhirClient = ctx.newRestfulGenericClient("http://myFhirServer:8080/fhir");

This is a problem when I want to communicate with 2 FHIR servers, and only 1 of them is behind a proxy:

var secondFhirClient = ctx.newRestfulGenericClient("http://myOtherFhirServer:8080/fhir");

This fails if http://myOtherFhirServer:8080 is not accessible via the proxy I specified earlier.

The workaround is to use multiple FhirContext objects. This is suboptimal; because a FhirContext is a heavyweight object; ~70MB for a DSTU3 once it's been used for a few FHIR operations including validation.

I'm experiencing a pathological case where I have ~40 FHIR servers to talk to behind different proxies; which means the memory requirement is large even though the majority of the FhirContext data could be shared between the servers.

Environment (please complete the following information):

  • HAPI FHIR Version: 6.4.4
  • OS: [e.g. iOS]: linux
  • Browser [e.g. chrome, safari]: n/a

Additional context
n/a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant