Stop running Kettle Job/Transformation using Java

☆樱花仙子☆ 提交于 2019-12-10 13:37:35

问题


I'm developing a web-app based ETL too (with Kettle engine), using Java.

I'm running into issues, while trying to stop a running Job. I'm not sure if using the CarteSingleton.java is correct. I'm using a custom singleton map.

My code is as below

Job job = new Job(null, jobMeta);
job.setLogLevel(LogLevel.DETAILED);
job.setGatheringMetrics(true);
job.start();

Once job.start() is invoked, I'm trying to store that job object in a custom singleton map and retrieve the exact Job object that was stored in map, and on invocation of stopAll() (see code below) with another REST call, while the Job's status is RUNNING, to stop it. But that doesn't stop the running job. Kettle Engine is not getting notified of this! Job Execution continues. The .kjb / .ktr was creating using SPOON, although I'm not using SPOON to run/stop execution.

Is there any Kettle API config I've to change, to be able to use

   same job object
   job.stopAll();

Could you please enlighten on the API and sample example, if any to stop a running JOB or transformation using Java?

Any pointers or help here would be great! Thanks, again.

Regards, Sanjeev


回答1:


Your approach seems to be correct. However, note that the immediate stoppage cannot be guaranteed - it simply sets a flag indicating the execution should not be to continued.

Job.stopAll() sets the flag and it is checked before the execution starts, but if it has begun it will not stop it on the spot

Trans.stopAll() behaves similarly. It asks each step to stop and that flag is checked inside steps.



来源:https://stackoverflow.com/questions/33095298/stop-running-kettle-job-transformation-using-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!