Hello everyone, I am an elasticsearch developer. Due to business needs, I need to develop a plug-in. The logic of this plug-in is relatively complex. I need the degbug plug-in source code. I can debug the plug-in locally in elasticsearch6.8 through the following code,
public class EmbeddedNode extends Node {
private Version version;
private Collection<Class<? extends Plugin>> plugins;
public EmbeddedNode(Environment environment, Version version, Collection<Class<? extends Plugin>> classpathPlugins) {
super(environment, classpathPlugins, true);
this.version = version;
this.plugins = classpathPlugins;
}
public Collection<Class<? extends Plugin>> getPlugins() {
return plugins;
}
public Version getVersion() {
return version;
}
@Override
protected void registerDerivedNodeNameWithLogger(String nodeName) {
}
}
Modify the startup class and load the custom plug-in org.elasticsearch.bootstrap.Bootstrap
// Line 227 ExamplePlugin is the main class of the custom plugin
Collection plugins = new ArrayList<>();
Collections.addAll(plugins, ExamplePlugin.class);
node = new EmbeddedNode(environment, Version.CURRENT, plugins) {
@Override
protected void validateNodeBeforeAcceptingRequests(
final BootstrapContext context,
final BoundTransportAddress boundTransportAddress, List<BootstrapCheck> checks) throws NodeValidationException {
BootstrapChecks.check(context, boundTransportAddress, checks);
}
};
But in elasticsearch8.14, I can't find any way to degbug the plugin source code locally. Please help me. Thank you very much.