I am using Flink 1.10.1 since java 8, when I register a JobListener in my pipeline I have observed that if I run it in a local environment (IDE), it works correctly, however when I deploy uberjar in my production environment, the listener does not work. Any idea what may be happening?
In this case, I am trying to detect that the job has finished.
public static void main(String[] args) throws Exception {
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
DataStream<String> texts = env.fromCollection(Stream.of("1", "2", "3").collect(Collectors.toList()))
.map(new StringMap());
texts.print();
env.registerJobListener(new CustomJobListener());
env.execute();
}
public class CustomJobListener implements JobListener {
private static final Logger logger = LoggerFactory.getLogger(CustomJobListener.class);
@Override
public void onJobSubmitted(@Nullable JobClient jobClient, @Nullable Throwable throwable) {
}
@Override
public void onJobExecuted(@Nullable JobExecutionResult jobExecutionResult, @Nullable Throwable throwable) {
logger.info("Testing listener");
}
}