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

Base URL not dynamic #213

Open
erard22 opened this issue Sep 18, 2019 · 6 comments
Open

Base URL not dynamic #213

erard22 opened this issue Sep 18, 2019 · 6 comments

Comments

@erard22
Copy link

erard22 commented Sep 18, 2019

With the current specification the baseURL is static and cannot be changed during runtime. For simple scenarios or systems running on kubernetes this might be fine. But imagine a system using Consul for service discovery, there we might change the base url on the fly during runtime depending on the health of the endpoints. And depending on the underlying implementation changing the target should be possible without performance impact. Even the client is ApplicationScoped. The client should set the target with every request or check if the baseURL has changed. The change in mp-config could be done by an extension and must not be seen as static.

@kenfinnigan
Copy link
Contributor

Do you mean you want this functionality with injecting a CDI Bean of the interface, as it's already possible to do this with the programmatic API?

@erard22
Copy link
Author

erard22 commented Sep 18, 2019

Basically I would like to have an ApplicationScoped client that reacts on changes in the mp-config (at least for the URL), what is possible via the different mp-config extensions. Programmatically I can create a client with every request and use the current configured url then the client is RequestScoped
But digging more in the code this is probably not feasible. At least with RestEasy a new WebTarget and consequently a new proxy is needed.

@kenfinnigan
Copy link
Contributor

kenfinnigan commented Sep 18, 2019 via email

@sopgreg
Copy link

sopgreg commented May 19, 2020

+1

The URL (including protocol and port) should be easily changeable at runtime for the reasons already mentioned. We also do health monitoring on endpoints and need to switch URLs at runtime accordingly.

@OleKsimov
Copy link

Would be great to have this feature implemented. Right now using microprofile rest client for requests with different URLs is not quite possible. I receive a callback URL inside each request, create rest client every time for each callback url is not an option

@hbzhou
Copy link

hbzhou commented Sep 27, 2022

I have the same use case. One more thing, HTTP clients are heavy objects, and creating one on each request causes overhead

@jclingan jclingan added this to the Future milestone Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants