How to build Routes - 6.3

Talend Data Fabric Studio User Guide

EnrichVersion
6.3
EnrichProdName
Talend Data Fabric
task
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

The Build Route feature allows you to build a Route to an ESB Runtime KAR file in order to deploy it in Talend ESB Container, or to a Spring-boot based ESB Microservice Jar file that can be executed in standalone mode.

How to build a Route to an ESB Runtime KAR file

To build a Route to an ESB Runtime KAR file, complete the following:

  1. In the Repository tree view, right-click the Route you want to build, and select Build Route to open the [Build Route] dialog box.

    Note

    You can show/hide a tree view of all created Jobs in Talend Studio directly from the [Build Route] dialog box by clicking the and the buttons respectively. This accessibility helps to modify the selected items to be exported directly from the dialog box without having to close it and go back to the Repository tree view in Talend Studio to do that.

  2. In the To archive file field, browse to the directory where you want to save your built Route.

  3. In the Route Version area, select the version number of the Route you want to build if you have created more than one version of the Route.

  4. In the Build Type area, ESB Runtime Kar file is selected by default.

  5. Click Finish to validate your changes, complete the export operation and close the dialog box.

  6. If you want to rebuild the built Route into your own KAR with Maven, select the Add maven script check box in the Options area to include the required Maven script in the target archive, which is a .zip file in this case.

A .kar or .zip file for the Route is created in the defined place.

How to build a Route to a Spring-boot based ESB Microservice

To build a Route to a Spring-boot based ESB Microservice, complete the following:

  1. Click on the Studio tool bar, or select File > Edit Project Properties from the menu bar to open the [Project Settings] dialog box.

  2. In the tree diagram to the left of the dialog box, select Log4j to display the corresponding view.

  3. Customize the Log4j configuration as needed. The default Log4j XML instructions only output the WARN logs to the console. For more information on the log4j parameters, see http://wiki.apache.org/logging-log4j/Log4jXmlFormat.

    A sample Log4j configuration is shown below which will also provide a tesb.log file when the ESB Microservice is started. Note that the Log4j configuration is the same for the Studio and the ESB Microservice. Nevertheless a log4j.xml file can also be placed into an external configuration folder of the Microservice at runtime to provide a specific Log4j configuration for production deployment.

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
        <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
            <layout class="org.apache.log4j.PatternLayout">
                <param name="ConversionPattern" value="%d | %-5.5p | %-16.16t | %-32.32C %4L | %m%n"/>
            </layout>
        </appender>
        <appender name="rollingFile" class="org.apache.log4j.RollingFileAppender">
            <param name="file" value="tesb.log"/>
            <param name="MaxFileSize" value="1024KB"/>
            <param name="MaxBackupIndex" value="10"/>
            <layout class="org.apache.log4j.PatternLayout">
                <param name="ConversionPattern" value="%d | %-5.5p | %-16.16t | %-32.32C %4L | %m%n"/>
            </layout>
        </appender>
        <root>
            <priority value="info"/>
            <appender-ref ref="stdout"/>
            <appender-ref ref="rollingFile"/>
        </root>
    </log4j:configuration>
  4. If the Route contains the cCXF or cCXFRS component, you need to do the following before building the Route:

    • If the Service Activity Monitor is enabled, edit the <Studio_Home>/esb/agent.properties file to configure the Service Activity Monitoring Agent as needed. For more information about the properties of the agent.propeties, see the section on the Service Activity Monitoring Agent configuration in the Infrastructure Services Configuration Guide.

    • If the Service Locator is enabled, edit the <Studio_Home>/esb/locator.properties file to configure the Service Locator as needed. For more information about the properties of the locator.properties, see the section on the Service Locator configuration in the Infrastructure Services Configuration Guide.

    • If the Route is a service provider and the Authentication with the Username Token is enabled, edit the Studio_Home/esb/microservice/users.properties file to specify the authenticated user credentials following the format <USERNAME>=<PASSWORD>. For example, the following settings defines two users:

      tadmin=tadmin
      tesb=tesb
    • If the Authentication with the SAML Token, and Authorization is enabled, or if the Service Registry is used, you need to install the ESB enterprise artifacts into your local maven repository using the following commands from a console window:

      cd <TalendRuntimePath>/add-ons/maven-repo
      mvn clean package -s <Studio_Home>/configuration/maven_user_settings.xml

    For more information about the cCXF or cCXFRS component, see the Talend ESB Mediation Components Reference Guide.

  5. In the Repository tree view, right-click the Route you want to build, and select Build Route to open the [Build Route] dialog box.

  6. In the To archive file field, browse to the directory where you want to save your built Route.

  7. In the Route Version area, select the version number of the Route you want to build if you have created more than one version of the Route.

  8. In the Build Type area, select ESB Microservice (Spring Boot).

  9. In the options area:

    • select the Only export the default context option to export only the default context used in the Route;

    • select the Export as ZIP option to export the Route to a .zip file, which provides an external config folder and start scripts to start the Microservice with the external config folder for Linux (.sh) and Windows (.bat). If this option is not selected, the Route is exported as a .jar file by default.

  10. Click Finish to validate your changes, complete the export operation and close the dialog box. A pop up window appears prompting you that Maven needs to be set to online to build the ESB Microservice, as some libraries have to be downloaded from the remote Maven repository. Talend Studio requires Internet access when you use the ESB Microservice feature. Talend Studio does not provide a pure offline mode for the ESB Microservice build operation. Click Yes to change Maven to online mode.

    If the Finish operation leads to an error, you can find more information in the Studio log file <Studio_Home>\workspace\.metadata\.log.

A .jar or .zip file for the Route is created in the defined place. You can run it independent of Talend Studio in standalone mode. For more information about how to run the Microservice, see How to run a Microservice Route.