Stop Kettle job / conversion using Java

I am also developing web-based ETLs (with the Kettle engine) using Java.

I am having problems trying to stop Job. I am not sure if CarteSingleton.java is being used correctly. I use a custom singleton map.

My code is below

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

When the job.start () method is called, I try to save this job object in the singleton user map and get the exact Job object that was saved on the map, and when stopAll () is called (see code below) with another REST call, then Time as Job status is RUNNING to stop it. But this does not stop work. Kettle engine does not receive a notification about this! The task continues. The .kjb / .ktr file was created using SPOON, although I do not use SPOON to start / stop execution.

Is there any Kettle API configuration that I have to change in order to be able to use

  same job object job.stopAll(); 

Could you talk about the API and the example example, if any, to stop running work or conversion using Java?

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

Regards, Sanjeev

+6
source share
1 answer

Your approach seems right. However, note that an immediate stop cannot be guaranteed - it simply sets a flag indicating that execution should not continue.

Job.stopAll() sets the flag and it is checked before starting the launch , but if it started it will not stop it in place

Trans.stopAll() behaves similarly. He sets each step to stop , and the flag is checked inside .

+5
source

All Articles