How to create user routines

Talend ESB Studio User Guide

EnrichVersion
6.4
EnrichProdName
Talend ESB
task
Design andĀ Development
EnrichPlatform
Talend Studio

You can create your own routines according to your particular factorization needs. Like the system routines, the user routines are stored in the Repository tree view under Code > Routines. You can add folders to help organize your routines and call them easily in any of your Jobs.

To create a new user routine, complete the following:

  1. In the Repository tree view, expand Code to display the Routines folder.

  2. Right-click Routines and select Create routine.

  3. The [New routine] dialog box opens. Enter the information required to create the routine, ie., its name, description...

  4. Click Finish to proceed to the next step.

    The newly created routine appears in the Repository tree view, directly below the Routines node. The routine editor opens to reveal a model routine which contains a simple example, by default, comprising descriptive text in blue, followed by the corresponding code.

    Note

    We advise you to add a very detailed description of the routine. The description should generally include the input and output parameters you would expect to use in the routine, as well as the results returned along with an example. This information tends to be useful for collaborative work and the maintenance of the routines.

    The following example of code is provided by default:

    public static void helloExample(String message) {
            if (message == null) {
                message = "World"; //$NON-NLS-1$
            }
            System.out.println("Hello " + message + " !");

  5. Modify or replace the model with your own code and press Ctrl+S to save the routine. Otherwise, the routine is saved automatically when you close it.

Note

You can copy all or part of a system routine or class and use it in a user routine by using the Ctrl+C and Ctrl+V commands, then adapt the code according to your needs. For further information about how to customize routines, see Customizing the system routines.

Note

You can right-click your user routine to use the Impact Analysis feature. This feature indicates which Jobs use the routine and would therefore be impacted by any modifications. For further information about Impact Analysis, see How to analyze repository items.