3
votes

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

1

1 Answers

4
votes

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();