Capturing and acting on different return codes

This recipe shows how we can use the return codes from a child job to control the process flow in a schedule more effectively.

Getting ready

Open the job jo_cook_ch11_0050_ChildReturnCodes. You will see that it is a simpler version of the job from the previous exercise.

How to do it…

We will begin by printing the return code from a child job.

Printing return code

  1. Add a tJava component with the following code:
    System.out.println("Return code is: "+((Integer)globalMap.get("tRunJob_1_CHILD_RETURN_CODE")));
  2. Link from the task to the tJava component using OnSubjobOk.
  3. Run the job—you will see that the return code is 0.

    Setting the return code

  4. Double-click on the child job to open it.
  5. Add a tDie component, and link ...

Get Talend Open Studio Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.