Skip to main content Skip to complementary content

Building a Data Service Job as a Spring Boot Microservice (deprecated)

Availability-noteDeprecated

About this task

In the [Build Job] dialog box, you can change the build type to build a Data Service Job to a Spring-boot based ESB Microservice.

This build type is deprecated from 8.0 R2024-02 and will be removed in R2024-09. To build a Data Service Job with the new Microservice build type, you need to:
  • check the configuration for Microservices,
  • change the build type of your Data Service Job to Microservice and rebuild/test/redeploy it.
For more information, see Building a Data Service Job as a Microservice.
Information noteWarning: Only Jobs that include the tRESTRequest component can be built as a Microservice.

Procedure

  1. Click Project properties on the Talend Studio toolbar, or select File > Edit Project Properties from the menu bar to open the Project Settings dialog box.
    Default configuration of Spring Boot Microservices
  2. In the tree to the left of the dialog box, select Build > Spring Boot microservices > Default configuration to display the corresponding view and customize the Spring Boot Microservice configuration as needed.
  3. In the tree to the left of the dialog box, select Log4j to display the corresponding view.
    Log4j configuration
  4. Customize the Log4j configuration as needed. The default Log4j XML instructions only output the WARN logs to the console.
    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 Talend 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>
  5. In the tRESTRequest component of the Job, you need to use relative endpoint URL instead of absolute URL. When the Microservice is running, an embedded Tomcat container with the default 8065 port is started by Spring-boot. The REST service also runs in this port. If you want to override the default port, either use the --server.port option in the command or configure it in the application.properties file in the /config folder inside the Microservice jar.
    If one or more of the ESB infrastructure services are used, you need to do the following before building the Job:
    • 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.properties, see Service Activity Monitoring Agent configuration.

    • 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 Configuring the Service Locator.

    • If the Job 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, 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
  6. Open the Job that you want to build as a Microservice in the design work space. In the Deployment view of the Job tab, select Microservice (Spring Boot) from the Build Type list. Save the Job.
    Deployment view of the Job tab.
  7. In the Repository tree view, right-click the Job you want to build, and select Build Job to open the Build Job dialog box.
    Build Job dialog box.
  8. In the To archive file field, browse to the directory where you want to save your built Job.
  9. In the Job Version area, select the version number of the Job you want to build if you have created more than one version of the Job.
  10. In the Build Type area, select Microservice Spring Boot.
  11. In the options area:
    • select the Export as ZIP option to export the Job 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 Job is exported as a .jar file by default.

    • select the Enable Prometheus metrics endpoint check box to build the Prometheus metrics endpoint into the Microservice to monitor the execution of Jobs, JVM memory, CPU consumption, and so on. By default, this feature bridges all the JMX attributes and values into Prometheus. For more information about Prometheus, see the Prometheus documentation.
  12. 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.
    Configure Maven Online.
    If the Finish operation leads to an error, you can find more information in the Talend Studio log file <Studio_Home>\workspace\.metadata\.log.

Results

A .jar or .zip file for the Job is created in the defined place. You can run it independently of Talend Studio in standalone mode. For more information about how to run the Microservice, see Running a Route built as a Spring Boot Microservice (deprecated).

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!