[JAVA] Utilization of Talend component (5) Create your own component

Create your own Talend component

Previously, I introduced how to use a custom component for processing that cannot be achieved by a standard component, but this time I will show you how to create a component.

Component creation method changed in Talend version 7 or later

Prior to version 6 of Talend, Talend Studio came with a feature called Component Designer, which allowed you to create components. However, in version 7 and later, Component Designer has been abolished and changed to the method of developing in a Java integrated development environment such as Eclipse and IntelliJ.

Development environment preparation

Talend Component Kit is required for component development, so use IntelliJ with plugins available. Start IntelliJ, create an empty project, open the setting screen from the file in the menu, enter Talend from the search tab of the plugin marketplace, Talend Component Kit will be displayed, select this and install it And restart IntelliJ. Java JDK 1.8.x is required for Java.

New project

From the Welcome to IntelliJ IDEA screen, click New Project, select Talend Component Kit and click Next. 00_新規プロジェクト_Talend Component Kit選択.jpg The Talend STARTER TOOLKIT shown below is displayed. 01_STARTER TOOLKIT_開始直後.jpg

Metadata definition

The Talend STARTER TOOLKIT screen defines component and project metadata. This time, set the contents shown in the figure below. 02_STARTER TOOLKIT_メタデータ入力後.jpg Enter each item and click ③ Add A Component on the left side of the screen to display the Configuration screen. 03_STARTER TOOLKIT_Add_Component_クリック直後.jpg

Standard definition settings for components

On the Configration screen, set the component name and input / output settings. This time, change only the name to Logger as shown in the figure below, and input / output is done with the default settings. 04_STARTER TOOLKIT_Add_Component_Logger入力後.jpg Click Next to display the project name and save location setting screen shown below. Change it if necessary and click the Finish button. 06_プロジェクト保存場所.jpg

Confirmation of project

When the STARTER TOOLKIT is completed, you will be taken to the IntelliJ project screen. At this point, the minimum settings required to create the component are complete. When you open LoggerProcessor.java from your project, the code base needed to create the component is already created. 07_プロジェクト保存後のLoggerProcessor.jpg

Compiling and deploying components

At this point, it's a component that doesn't work at all, but I'll try deploying it to Talend OpenStudio. In the IntelliJ terminal, type mvnw clear install to compile. 08_IntelliJ_ターミナル_mvnwコマンド.jpg The compilation is executed as shown in the figure below and ends normally. 09_IntelliJ_ターミナル_mvnwコマンド実行後.jpg Then enter mvnw talend-component: deploy-in-studio -Dtalend.component.studioHome = "C: \ Talend \ 7.1.1_TOS_DI" to deploy to Talend OpenStudio. For the path enclosed in double quotes, set the path to the home of Talend OpenStudio that uses the component you are deploying. 10_TalendOpenStudioへのデプロイコマンド入力後.jpg Deployment is executed as shown in the figure below and ends normally. 11_TalendOpenStudioへのデプロイコマンド実行後.jpg

Use components created from Talend OpenStudio

Start Talend OpenStudio specified as the deployment destination and create an empty job. When you open the Palette Misc, the SampleFamily defined in the STARTER TOOLKIT metadata is displayed, and the deployed component SampleFamilyLogger is available. Make sure that you can place it in the job and use it. 12_TalendOpenStudioでジョブからコンポーネント使用.jpg

Add code to display the input contents

Since it is a component that does not have any visual result even if it is executed as it is, change it to a component that displays the input contents. Exit TalendOpenStudio, go back to IntelliJ, open LoggerProcessor.java, look for @ElementListener and add the following two lines. //Log to the console System.out.println("Input["+defaultInput+"]"); 13_Inputを表示するコードを追加.jpg Compile and deploy from the terminal as before. Start Talend OpenStudio again, open the previous job, add tFileInputDelimitede to the Input side of the component, and execute the job. The input contents from the file will be displayed in the execution result. 14_出力追加後のジョブ実行結果.jpg

Summary

By using IntelliJ and Talend Component Kit, I was able to easily create a component base. Next time, I would like to dig a little deeper and create a component.

Recommended Posts

Utilization of Talend component (5) Create your own component
Create your own Java annotations
Create your own Solr Function Query
Create your own encode for String.getBytes ()
Create your own validator with Bean Validation
Create your own shortcuts in Xcode to eliminate the hassle of pod install
Create your own Android app for Java learning
Create your own Utility with Thymeleaf with Spring Boot
[Java] Sort ArrayList with elements of your own class
Utilization of Active Hash
Make your own pomodoro
Utilization of seed file