Open KrohnicDev opened 1 month ago
Hi @KrohnicDev
Thank you for reaching out! Unfortunately there's no API that can help you to read a list of active plugins. Plugins are loaded based on wrapperPlugins
property. Is property isn't specified then default plugins are loaded.
Would you be able to provide a brief description on the issue you're trying to solve by getting a list of active plugins? Thank you!
I would like to print what plugins are active on startup AND allow use of default plugins. Currently there is no way to do both. If you want to print active plugins, you have to set them explicitly.
Hi @KrohnicDev
There's a logging of a loaded and rearranged plugins. It's a list of effective plugins that takes into account wrapperPlugins
configuration parameter, plugin factories from configuration profiles and various internal defaults. You might find it useful.
2024-09-06T16:42:27.5383755Z [2024-09-06 16:42:27.464] [FINEST ] [Test worker] [software.amazon.jdbc.ConnectionPluginChainBuilder getPlugins] : Plugins order has been rearranged. The following order is in effect: AuroraConnectionTrackerPluginFactory, FailoverConnectionPluginFactory, HostMonitoringConnectionPluginFactory
Thanks. I also have a use case where I would like to execute some logic based on whether efm/efm2 plugin is active. Based on this discussion, I assume that it's currently not possible. Could you please confirm?
Hi @KrohnicDev
I think you can use the following workaround to check whether particular plugin is loaded. The idea is described here:
The code example provided on that page shows how to use unwrap()
method on a database connection to access ExceptionSimulator
(that is implemented by Developer Plugin). You can use the same approach to get a reference to efm/efm2 plugin instance loaded for a connection. You can use the following classes as a parameter to unwrap()
method.
software.amazon.jdbc.plugin.efm.HostMonitoringConnectionPlugin
software.amazon.jdbc.plugin.efm2.HostMonitoringConnectionPlugin
Please pat attention that unwrap()
raises a SQLException
if plugin is not presented/loaded for a particular connection.
I hope that helps.
Hi! I would like to read programmatically what plugins are active when
wrapperPlugins
property is not explicitly set, i.e. what are the default plugins. Is there an API for that?