pf4j-update for reading plugins run time?

Skip to first unread message

Sonali Amonkar

Jul 3, 2019, 6:11:24 AM7/3/19
to pf4j

I am trying to use pf4j-update for a demonstration to 
1) detect and read plugins runtime (i.e. when they are added to the plugins folder after the server has started). Is pf4j-update right for this? 

I am trying this example for a simple spring boot application with 2 dummy plugins. The plugins are detected when the server is started. I then tried with a single plugin on server start and then tried adding a newer plugin to the folder later. I also updated plugin.json. Are these the only changes required? 
Do I need to write the code from UpdateTest in a Daemon thread to be able to keep detecting the folder? Or is this taken care of by the Updatemanager?


Decebal Suiu

Jul 3, 2019, 12:11:31 PM7/3/19
to pf4j
I think that you don't need pf4j-update for a such thing.
What you need to do is to create a few line of code in your project that watching `pf4.pluginsDir` directory using WatchService ( and calls PluginManager.loadPlugin(Path) or similar methods (delete, ...).
pf4j-update is for more complicated things (for example used as canal to update all servers in production).

Sonali Amonkar

Jul 4, 2019, 4:12:24 AM7/4/19
to pf4j
Ok will do. Thank you for your kind direction!
Reply all
Reply to author
0 new messages