Creating a data integration Job - 6.3

Talend Real-time Big Data Platform Studio User Guide

EnrichVersion
6.3
EnrichProdName
Talend Real-Time Big Data Platform
task
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

In this section, a data integration Job is created to insert data into a MySQL database.

Adding and linking components

  1. From the palette, drag and drop a tPrejob, a tMysqlConnection, a tRouteInput, a tMap, a tLogRow, a tMysqlOuput, a tPostjob and a tMysqlClose component onto the design workspace. Link them together with the Row > Main connection.

  2. Link the tPrejob component to the tMysqlConnection component using a Trigger > On Component Ok connection to build the pre-job.

  3. Link the tRouteInput component to the tMap component using a Row > Main connection.

  4. Connect the tMap component to the tLogRow component using the Row > New Output (Main) connection and name the output connection as row2.

  5. Link the tLogRow component to the tMysqlOuput component using a Row > Main connection.

  6. Link the tPostjob component to the tMysqlClose component using a Trigger > On Component Ok connection to build the post-job.

    Note

    The use of tMysqlClose in the post-job as shown above in the Route-Job example is not valid for Data Service operation Jobs containing tESBProviderRequest, tESBProviderResponse, tESBProviderFault, or tRestRequest components. In these kind of Jobs it is not recommended to use close connection components like tMySQLClose. Because closing datasource connection is implemented directly in the tESBProvider* and tRestRequest components.

Configuring the components

Configuring the pre-job

In the pre-job, the component does not have any parameter or property to configure. It just initialize the connection to the MySQL database before the execution of the main Job. So all the required configurations are made in the tMysqlConnection component.

  1. Double-click tMysqlConnection to open its Basic settings view in the Component tab.

  2. Set the database connection details in the relevant fields, including:

    • the host name or IP address of your database server

    • the listening port number

    • the database name

    • the user name and password for your database authentication.

    These connection parameters are used when you run the Route to call this Job in the Studio. If you want to deploy the Route and the Job in Talend Runtime, you can leave these parameters empty and go to the next step directly.

  3. Select the Specify a data source alias check box and enter the data source alias, which is set in the datasource configuration file in Talend Runtime.

  4. In the Advanced Settings tab, select the Auto Commit check box to commit any changes to the database automatically upon the transaction.

Configuring the main Job

  1. Double-click tRouteInput to open its Basic settings view in the Component tab.

  2. Click [...] next to Edit Schema. In the schema dialog box, click the plus button to add a new line of String type and name it body. Set the length of this column to 50. Click OK to close the dialog box.

  3. In the Simple Expression column for the body element, enter "${in.body}" to get the body of the input message from the Route.

  4. Double-click tMap to open the tMap editor.

  5. In the lower right corner of the tMap editor, click [+] to add a column of String type in the output table and name it welcomeText. Set the length of this column to 50.

    In the upper left corner of the editor, select the body column and drop it to the output table. In the Expression field of the output table, add + " Talend!" as the welcome text. When done, click OK to validate your changes, close the editor and propagate the changes to the next component.

  6. The tLogRow component is used to monitor data processed and does not need any configuration.

  7. Double-click tMysqlOuput to open its Basic settings view in the Component tab.

  8. Select the Use an existing connection check box and select the tMysqlConnection_1 in the Component List to reuse the connection details that you have already set.

    In the Table name field, enter Hello as the name of the table to be created.

    Select Drop table if exists and create in the Action on table list, and select Insert in the Action on data list.

    Click Sync columns to retrieve the schema set in the tMap.

Configuring the post-job

In the post-job, the tPostjob component does not have any parameter or property to configure. It just closes the database connection.

  1. Double-click tMysqlClose to open its Basic settings view in the Component tab.

  2. The Component List is already filled in with tMysqlConnection_1. Keep this setting and press Ctrl+S to save your Job.