Hi,
I try to write a java plugin for Logstash, i need to schedule my program with a parameter passed in the configuration file. I tried to use the Java Timer for this but doesn't work. The pipeline execute the code but termite after few seconds. Following my code in the start method of java class
@Override
public void start(Consumer<Map<String, Object>> consumer) {
// The start method should push Map<String, Object> instances to the supplied QueueWriter
// instance. Those will be converted to Event instances later in the Logstash event
// processing pipeline.
//
// Inputs that operate on unbounded streams of data or that poll indefinitely for new
// events should loop indefinitely until they receive a stop request. Inputs that produce
// a finite sequence of events should loop until that sequence is exhausted or until they
// receive a stop request, whichever comes first.
Timer timer = new Timer("Logstash Plugin");
timer.scheduleAtFixedRate(mymethod, 0L, 300000);
}
Thank you for help
Good day
Antonio