Configuring the components - 6.4

Talend Big Data Platform Studio User Guide

EnrichVersion
6.4
EnrichProdName
Talend Big Data Platform
task
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio
  1. Double-click the tSetGlobalVar component to display its Basic settings view in the Component tab.

  2. Click the [+] button to add a line in the Variables table:

    In the Key field, type in jsonEncoded

    In the Value fields, type in:

    MetaServlet.base64Encode("{\"actionName\":\"runTask\",\"taskId\":\"" + context.task_id + "\",\"mode\"
    :\"synchronous\",\"context\":{\"Default\":\"" + ((String)globalMap.get("tMsgBox_1_RESULT")) + "\"},
    \"authPass\":\"" + context.tac_pwd + "\",\"authUser\":\"" + context.tac_user + "\"}") 

    to call the routine you have previously created.

  3. Then double-click the tREST component to display its Basic settings view.

  4. Fill the URL field with the URL of the Web service you are going to invoke. For this use case, type in:

    context.tac_url + "/metaServlet?" +((String)globalMap.get("jsonEncoded"))

    to call the service and encode the MetaServlet parameters in a Json format.

  5. From the HTTP Method list, select GET to send an HTTP request for generating a task.

    In this way, the MetaSerlet is invoked via the REST API of Talend Administration Center with the relevant parameters.

  6. In the Basic settings view of the tLogRow component, select the Basic option to display the result in the Run console.

  7. Save your Job and press F6 to launch it.

    The console shows that the tREST component sends an HTTP request to the server end to run the specified task, and that the task has been executed without errors.

    In the Job Conductor page of Talend Administration Center, the status of the task is now ready to run.