Scenario 2: Buffering output data on the webapp server - 6.1

Talend Components Reference Guide

EnrichVersion
6.1
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 Data Quality
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

This scenario describes a Job that is called as a Webservice and stores the output data in a buffer directly on the server of the Web application. This scenario creates first a Webservice oriented Job with context variables, and next exports the Job as a Webservice.

Creating a Job

  1. Drop the following components from the Palette onto the design workspace: tFixedFlowInput and tBufferOutput.

  2. Connect tFixedFlowInput to tBufferOutput using a Row Main link.

Creating a context variable

For this scenario, you will define two context variables: nb_lines and lastname. The first variable will set the number of lines the tFixedFlowInput component will generate, and the second one will set the last name to display in the output list. For more information about how to create and use context variables, see Talend Studio User Guide.

To define the two context variables:

  1. Select the Contexts tab view of your Job, and click the [+] button at the bottom of the view to add two variables, respectively nb_lines of type Integer and lastname of type String.

  2. In the Value field for the variables, set the last name to be displayed and the number of lines to be generated, respectively Ford and 3 in this example.

Configuring the input data

  1. In the design workspace, select tFixedFlowInput.

  2. Click the Component tab to define the basic settings for tFixedFlowInput.

  3. Click the three-dot [...] button next to Edit Schema to describe the data structure you want to create from internal variables. In this scenario, the schema is made of three columns, now of type Date, firstname of type String, and lastname of type String.

  4. Click OK to close the dialog box and accept propagating the changes when prompted by the system. The three defined columns display in the Values panel of the Basic settings view of tFixedFlowInput.

  5. Click in the Value cell of each of the first two defined columns and press Ctrl+Space to access the global variable list.

  6. From the global variable list, select TalendDate.getCurrentDate() and talendDatagenerator.getFirstName, for the now and firstname columns respectively.

  7. Click in the Value cell of lastname column and press Ctrl+Space to access the global variable list.

  8. From the global variable list, select context.lastname, the context variable you created for the last name column.

Building your Job as a Webservice

Before building your Job as a Web service, see Talend Studio User Guide for more information.

  1. In the Repository tree view, right-click on the above created Job and select Build Job. The [Build Job] dialog box appears.

  2. Click the Browse... button to select a directory to archive your Job in.

  3. In the Build type panel, select the build type you want to use in the Tomcat webapp directory (WAR in this example) and click Finish. The [Build Job] dialog box disappears.

  4. Copy the War folder and paste it in a Tomcat webapp directory.