Conversation
|
Is there a guarantee about ordering of event listeners provided by a plugin instance like the description? Or is the guarantee that you can inject plugin instances only without effects to listener ordering? |
|
The requirement is that if you wish to inject dependencies to your plugin then you have to declare them as We could relax it but it requires changing the actual load algorithm, which can be independent from the ordering of |
|
I have extended the support for indirect dependencies, where plugin C declares itself as having dependency on plugin B but as For example the following works: @Plugin("pluginb")
public final class PluginB {
@Inject
public PluginB(final Set<Service> service) {
//services has PluginC
}
public static final class Module extends AbstractModule {
@Override
protected void configure() {
Multibinder.newSetBinder(this.binder(), Service.class);
}
}
}
@Plugin("pluginc")
public final class PluginC {
public static final class Module extends AbstractModule {
@Override
protected void configure() {
Multibinder.newSetBinder(this.binder(), Service.class).addBinding().to(PluginC.class);
}
}
} |
This allows plugins to provide a Guice module to expose services to their dependencies and dependents which are injected to their plugin instance.
Example 1, plugin A can provide implementation for a service which plugin B can consume.
Example 2, plugin C can discovered services provided by other plugins.