Question

I have a Job in Pentaho. The job has one transformation which returns back JSON Output. How do I access it using Java API? I need to read that JSON and print it. My code is:

    KettleEnvironment.init();
    JobMeta jobMeta = new JobMeta("Job.kjb", null);
    Job job = new Job(null, jobMeta);          
    job.start();
    job.waitUntilFinished()    
    System.out.println("dfffdgfdg: "+job.getResult());

Do i need to have row listener? but how to set it as the step is in KTR inside job. I am completely confused. Please help

Was it helpful?

Solution

In your last transformation ie KTR, dont forget to add the STEP - Copy rows to result. After that .. when you run the JOB through your Java . use following code to access result:

final List<RowMetaAndData> read;
read = job.getResult().getRows();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top