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

Refresh dependency #1103

Open
Juandavi1 opened this issue Jul 20, 2023 · 5 comments
Open

Refresh dependency #1103

Juandavi1 opened this issue Jul 20, 2023 · 5 comments

Comments

@Juandavi1
Copy link

Juandavi1 commented Jul 20, 2023

Hi 👋 awesome project !

We have a microservice with spring cloud config integration.

Do you know how we can refresh dependencies when the spring cloud config changes ?

@r-hang
Copy link
Contributor

r-hang commented Jul 25, 2023

Hey, could you provide an example of the issue, perhaps with some code?

@Juandavi1
Copy link
Author

Hi 👋 It is a question not an issue🙋🏻‍♂️
How we can recreate an instance at runtime with fx ?

@sywhang
Copy link
Contributor

sywhang commented Jul 25, 2023

Not sure how you have set up the fx app currently. But if you don't need the app's state to persist between refreshes I imagine you could just re-create an fx.App, right?

@Juandavi1
Copy link
Author

is correct, but that would start the entire application completely including the server. the idea is to update only one dependency within the app.

@sywhang
Copy link
Contributor

sywhang commented Jul 27, 2023

This isn't something that's supported in Fx.

Thinking out loud though, to support such a feature, we can't update a single dependency within the app. At the very least, this will need to update anything that depends on that particular dependency, so it'll need to re-populate potentially a big chunk of the app.

Another interesting point to consider is what to do with the lifecycle hooks - i.e. when a dependency is "re-loaded", does it run the onstop hook of the previously registered dependency, what about its onstart hook, etc.

These are interesting points of discussion that warrants some more thought into the design.

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

No branches or pull requests

3 participants