Creating user routines - 7.2

Talend ESB Studio User Guide

EnrichVersion
7.2
EnrichProdName
Talend ESB
EnrichPlatform
Talend Studio
task
Design and Development

You can create your own routines according to your particular factorization needs.

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.

About this task

To create a new user routine, complete the following:

Procedure

  1. In the Repository tree view, right-click the Code > Routines node and select Create routine.
    The New routine dialog box opens.
  2. Enter the information for the new routine, ie., its name, description, etc.
  3. Click Finish.
    The newly created routine is saved in the Repository tree view. 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 + " !");
  4. 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.

    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 Analyzing repository items.