Configuring the Routine - 6.5

Data Integrationジョブの例

author
Talend Documentation Team
EnrichVersion
6.5
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
task
ジョブデザインと開発 > ジョブデザイン
EnrichPlatform
Talend Studio

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.

Procedure

  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:

    import com.sun.org.apache.xml.internal.security.utils.Base64;

    To do so, start typing and press Ctrl+Space to open the list of templates, then select com.sun.org.apache.xml.internal.security.utils.*; 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\",
    \"authPass\":\"talend\",\"authUser\":\"talend@talend.com\"}";
    
        	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.