July 30, 2023

tLibraryLoad – Docs for ESB 7.x

tLibraryLoad

Loads useable Java libraries in a Job.

Depending on the Talend
product you are using, this component can be used in one, some or all of the following
Job frameworks:

tLibraryLoad Standard properties

These properties are used to configure tLibraryLoad running in the Standard Job
framework.

The Standard
tLibraryLoad component belongs to the Custom Code family.

The component in this framework is available in all Talend
products
.

Basic settings

Library

Click on the […] button to to open the Module dialog
box from which you can import the library to be used.

For more information, see Importing an external library.

Advanced settings

Dynamic Libs

Lib Paths: Enter the access path to your
library, between double quotation marks.

Import

Enter the Java code required to import, if required, the external
library used in the code editing field of the Basic
settings
tab of the components such as tJava,or tJavaFlex.

Global Variables

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Usage

Usage rule

This component may be used alone, although it
is more logical to use it as part of a Job.

Limitation

The library is loaded locally.

Importing an external library

To enable this component to load an external library, you need first to import
the library into the component.

  1. If the library to be imported isn’t available on your machine, either download
    and install it using the Modules view or download and
    store it in a local directory.
  2. In the Drivers table, add one row to the table by
    clicking the [+] button.

    tLibraryLoad_1.png

  3. Click the newly added row and click the […] button to
    open the Module dialog box where you can import the
    external library.

    tLibraryLoad_2.png

  4. If you have installed the library using the Modules
    view:

    • Select the Platform option and then select the
      library from the list.
    • Select the Artifact repository (local m2/nexus) > Find by name or Artifact repository (local m2/nexus) > Find by Maven URI option, then specify the full name or Maven URI of the
      library module, and click the Detect the module install
      status
      button to validate its installation status.
  5. If you have stored the library file in a local directory:

    1. Select the Artifact repository (local m2/nexus)
      option.
    2. Select the Install a new module option, and
      click the […] button to browse to library
      file.
    3. If you need to customize the Maven URI of the library, select the
      Custom MVN URI check box, specify the new
      URI, and then click the Detect the module install
      status
      button to validate its installation status.

      Note:

      Changing the Maven URI for an external module will affect all the
      components and metadata connections that use that module within
      the project.

      When working on a remote project, your
      custom Maven URI settings will be automatically synchronized to
      the Talend Artifact Repository and will be used
      when other users working on the same project install the
      external module.

  6. Click OK to confirm your changes.

    The imported library file is listed in the Drivers
    table.
    Note: You can replace or delete the imported library, or import new libraries
    if needed.

Checking the format of an e-mail address

This scenario uses two components, a tLibraryLoad and
a tJava. The goal of this scenario is to check the
format of an e-mail address and verify whether the format is valid or not.

tLibraryLoad_3.png

Setting up the Job

  1. In the Palette, open the Custom_Code folder, and slide a tLibraryLoad and tJava
    component onto the workspace.
  2. Connect tLibraryLoad to tJava using a Trigger > OnSubjobOk
    link.

Configuring the tLibraryLoad component

  1. Import the external library to be used in the Job.

    1. Double-click on tLibraryLoad to display
      its Basic settings.
    2. Click the […] button to open the
      Module dialog box.
    3. Select jakarta-oro-2.0.8.jar from the
      Platform list.
    4. Click OK to confirm loading the library and clode the
      dialob box.
  2. In the Import field of the
    Advanced settings tab, type
    import org.apache.oro.text.regex.*;

    tLibraryLoad_4.png

Configuring the tJava component

  1. Double-click on tJava to display its
    Component view.
  2. In the Basic settings tab, enter your
    code, as in the screenshot below. The code allows you to check whether the
    character string pertains to an e-mail address, based on the regular
    expression: "^[\w_.-]+@[\w_.-]+\.[\w]+$".

    tLibraryLoad_5.png

Job execution

Press F6 to save and run the Job.

tLibraryLoad_6.png

The Console displays the boolean
false. Hence, the e-mail address is not valid as the format
is incorrect.

tLibraryLoad MapReduce properties (deprecated)

These properties are used to configure tLibraryLoad running in the MapReduce Job
framework.

The MapReduce
tLibraryLoad component belongs to the Custom Code family.

The component in this framework is available in all subscription-based Talend products with Big Data
and Talend Data Fabric.

The MapReduce framework is deprecated from Talend 7.3 onwards. Use Talend Jobs for Apache Spark to accomplish your integration tasks.

Basic settings

Library

Click on the […] button to to open the Module dialog
box from which you can import the library to be used.

For more information, see Importing an external library.

Advanced settings

Dynamic Libs

Lib Paths: Enter the access path to your
library, between double quotation marks.

Import

Enter the Java code required to import, if required, the external
library used in the code editing field of the Basic
settings
tab of the components such as tJavaMR in a Map/Reduce Job.

Global Variables

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Usage

Usage rule

In a
Talend
Map/Reduce Job, this component is used standalone. It
generates native Map/Reduce code that can be executed directly in Hadoop.

You need to use the Hadoop Configuration tab in the
Run view to define the connection to a given Hadoop
distribution for the whole Job.

This connection is effective on a per-Job basis.

For further information about a
Talend
Map/Reduce Job, see the sections
describing how to create, convert and configure a
Talend
Map/Reduce Job of the

Talend Open Studio for Big Data Getting Started Guide
.

Note that in this documentation, unless otherwise
explicitly stated, a scenario presents only Standard Jobs,
that is to say traditional
Talend
data integration Jobs, and non Map/Reduce Jobs.

Limitation

The library is loaded locally.

Related scenarios

No scenario is available for the Map/Reduce version of this component yet.

tLibraryLoad properties for Apache Spark Batch

These properties are used to configure tLibraryLoad running in the Spark Batch Job
framework.

The Spark Batch
tLibraryLoad component belongs to the Custom Code family.

The component in this framework is available in all subscription-based Talend products with Big Data
and Talend Data Fabric.

Basic settings

Library

Click on the […] button to to open the Module dialog
box from which you can import the library to be used.

For more information, see Importing an external library.

Advanced settings

Import

Enter the Java code required to import, if required, the external
library used in the code editing field of the Basic
settings
tab of the components such as tJavaMR in a Map/Reduce Job.

Usage

Usage rule

This component is used with no need to be connected to other
components.

This component, along with the Spark Batch component Palette it belongs to,
appears only when you are creating a Spark Batch Job.

Note that in this documentation, unless otherwise explicitly stated, a
scenario presents only Standard Jobs, that is to
say traditional
Talend
data integration Jobs.

Spark Connection

In the Spark
Configuration
tab in the Run
view, define the connection to a given Spark cluster for the whole Job. In
addition, since the Job expects its dependent jar files for execution, you must
specify the directory in the file system to which these jar files are
transferred so that Spark can access these files:

  • Yarn mode (Yarn client or Yarn cluster):

    • When using Google Dataproc, specify a bucket in the
      Google Storage staging bucket
      field in the Spark configuration
      tab.

    • When using HDInsight, specify the blob to be used for Job
      deployment in the Windows Azure Storage
      configuration
      area in the Spark
      configuration
      tab.

    • When using Altus, specify the S3 bucket or the Azure
      Data Lake Storage for Job deployment in the Spark
      configuration
      tab.
    • When using Qubole, add a
      tS3Configuration to your Job to write
      your actual business data in the S3 system with Qubole. Without
      tS3Configuration, this business data is
      written in the Qubole HDFS system and destroyed once you shut
      down your cluster.
    • When using on-premise
      distributions, use the configuration component corresponding
      to the file system your cluster is using. Typically, this
      system is HDFS and so use tHDFSConfiguration.

  • Standalone mode: use the
    configuration component corresponding to the file system your cluster is
    using, such as tHDFSConfiguration or
    tS3Configuration.

    If you are using Databricks without any configuration component present
    in your Job, your business data is written directly in DBFS (Databricks
    Filesystem).

This connection is effective on a per-Job basis.

Limitation

The library is loaded locally.

Related scenarios

No scenario is available for the Spark Batch version of this component
yet.

tLibraryLoad properties for Apache Spark Streaming

These properties are used to configure tLibraryLoad running in
the Spark Streaming Job framework.

The Spark Streaming
tLibraryLoad component belongs to the Custom Code family.

This component is available in Talend Real Time Big Data Platform and Talend Data Fabric.

Basic settings

Library

Click on the […] button to to open the Module dialog
box from which you can import the library to be used.

For more information, see Importing an external library.

Advanced settings

Import

Enter the Java code required to import, if required, the external
library used in the code editing field of the Basic
settings
tab of the components such as tJavaMR in a Map/Reduce Job.

Usage

Usage rule

This component is used with no need to be connected to other components.

This component, along with the Spark Streaming component Palette it belongs to, appears
only when you are creating a Spark Streaming Job.

Note that in this documentation, unless otherwise explicitly stated, a scenario presents
only Standard Jobs, that is to say traditional
Talend
data
integration Jobs.

Spark Connection

In the Spark
Configuration
tab in the Run
view, define the connection to a given Spark cluster for the whole Job. In
addition, since the Job expects its dependent jar files for execution, you must
specify the directory in the file system to which these jar files are
transferred so that Spark can access these files:

  • Yarn mode (Yarn client or Yarn cluster):

    • When using Google Dataproc, specify a bucket in the
      Google Storage staging bucket
      field in the Spark configuration
      tab.

    • When using HDInsight, specify the blob to be used for Job
      deployment in the Windows Azure Storage
      configuration
      area in the Spark
      configuration
      tab.

    • When using Altus, specify the S3 bucket or the Azure
      Data Lake Storage for Job deployment in the Spark
      configuration
      tab.
    • When using Qubole, add a
      tS3Configuration to your Job to write
      your actual business data in the S3 system with Qubole. Without
      tS3Configuration, this business data is
      written in the Qubole HDFS system and destroyed once you shut
      down your cluster.
    • When using on-premise
      distributions, use the configuration component corresponding
      to the file system your cluster is using. Typically, this
      system is HDFS and so use tHDFSConfiguration.

  • Standalone mode: use the
    configuration component corresponding to the file system your cluster is
    using, such as tHDFSConfiguration or
    tS3Configuration.

    If you are using Databricks without any configuration component present
    in your Job, your business data is written directly in DBFS (Databricks
    Filesystem).

This connection is effective on a per-Job basis.

Limitation

The library is loaded locally.

Related scenarios

No scenario is available for the Spark Streaming version of this component
yet.


Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x