Configuring the Routine - 6.3

Talend Data Fabric Studio User Guide

English (United States)
Talend Data Fabric
Talend Studio
Data Quality and Preparation
Design and Development

You have to define a user routine that encodes the MetaServlet parameters in base64 to be transmitted to the REST API. This routine will be called in the Job.

  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, then 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.

  4. At the beginning, right after the package routines line of code, add the following:


    To do so, start typing and press Ctrl+Space to open the list of templates, then select*; then replace the * sign with Base64.

  5. Modify the model at the end with your own code:

    public static String base64Encode(String message) {
        	return message==null ? null : "" + Base64.encode(message.getBytes()).replace("\n", "");
    public static void main(String[] args) {
        	String tmp = "{\"actionName\":\"runTask\",\"taskId\":\"1\",\"mode\":\"synchronous\",
        	System.out.println("Base 64: " + base64Encode(tmp));

    This allows you to encode the MetaServlet action, runTask, in base64.

    For more information about the parameters and actions available in the MetaServlet, see the Talend Administration Center User Guide.