Apache flink 为什么JobListener在本地环境(IDE)中工作,而不是在我的生产环境中工作?

Apache flink 为什么JobListener在本地环境(IDE)中工作,而不是在我的生产环境中工作?,apache-flink,Apache Flink,我从java 8开始使用Flink 1.10.1,当我在管道中注册JobListener时,我发现如果我在本地环境(IDE)中运行它,它会正常工作,但是当我在生产环境中部署uberjar时,侦听器就不工作了。知道会发生什么吗 在本例中,我试图检测作业是否已完成 public static void main(String[] args) throws Exception { final StreamExecutionEnvironment env = StreamExecutio

我从java 8开始使用Flink 1.10.1,当我在管道中注册JobListener时,我发现如果我在本地环境(IDE)中运行它,它会正常工作,但是当我在生产环境中部署uberjar时,侦听器就不工作了。知道会发生什么吗

在本例中,我试图检测作业是否已完成

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");
    }
}
publicstaticvoidmain(字符串[]args)引发异常{
最终StreamExecutionEnvironment env=StreamExecutionEnvironment.getExecutionEnvironment();
DataStream text=env.fromCollection(Stream.of(“1”、“2”、“3”).collect(Collectors.toList()))
.map(新的StringMap());
text.print();
env.registerJobListener(新的CustomJobListener());
execute();
}
公共类CustomJobListener实现JobListener{
私有静态最终记录器Logger=LoggerFactory.getLogger(CustomJobListener.class);
@凌驾
JobSubmitted上的公共void(@Nullable JobClient JobClient,@Nullable Throwable Throwable){
}
@凌驾
JobExecuted上的public void(@Nullable JobExecutionResult JobExecutionResult,@Nullable Throwable Throwable){
logger.info(“测试侦听器”);
}
}