fe/fe-extension-spi/README.md
This guide is for plugin authors and business module integrators. It answers three practical questions:
fe-extension-spi is responsible for.fe-extension-spi provides contracts only. It does not provide runtime loading.
Core contracts in this module:
Plugin: plugin instance lifecycle.PluginFactory: plugin factory contract.PluginContext: runtime configuration carrier.PluginException: common runtime exception type.Capabilities intentionally excluded from this module:
Those runtime capabilities belong to fe-extension-loader.
Use fe-extension-spi directly if:
Use SPI + Loader if:
pluginRoots.scan, resolve, discover, etc.).PluginResponsibilities:
initialize(context): initialize plugin instance.close(): release plugin resources.Recommendations:
initialize minimal and deterministic.close idempotent.PluginFactoryResponsibilities:
name(): return stable logical plugin name.create(): create a plugin instance.create(context): optional context-aware create path (defaults to create()).Recommendations:
name() stable across environments.create() lightweight and side-effect-free.PluginContextResponsibilities:
Map<String, String>).Recommendations:
ldap.*, auth.*).PluginExceptionResponsibilities:
Recommendations:
public final class DemoPlugin implements Plugin {
@Override
public void initialize(PluginContext context) {
// init
}
@Override
public void close() {
// cleanup
}
}
public final class DemoPluginFactory implements PluginFactory {
@Override
public String name() {
return "demo";
}
@Override
public Plugin create() {
return new DemoPlugin();
}
}
File path:
META-INF/services/org.apache.doris.extension.spi.PluginFactory
File content:
com.example.demo.DemoPluginFactory
Your plugin jar should include:
META-INF/services/... service declaration file.name() must not be empty and should be globally distinguishable.close().Check in this order:
META-INF/services/... file present?Check in this order:
create() depend on uninitialized resources?PluginContext entries missing?Check in this order:
close() actually release pools and handles?Recommended composition:
fe-extension-spi.fe-extension-loader.Detailed Loader integration guide:
../fe-extension-loader/README.md
README_CN.md../fe-extension-loader/README.md../fe-authentication/EXTENSION_LOADER_UNIFIED_DESIGN_CN.md