Building a Route to a Microservice
- Cloud API Services Platform
- Cloud Data Fabric
- Data Fabric
- Data Services Platform
- ESB
- MDM Platform
- Qlik Talend Cloud Enterprise Edition
- Qlik Talend Cloud Premium Edition
- Real-Time Big Data Platform
About this task
To build a Route to a Microservice, complete the following:
Procedure
-
Click on the Talend Studio
tool bar, or select File > Edit Project Properties from the menu bar to open the Project Settings
dialog box.
-
In the tree to the left of the dialog box, select Build > Standalone microservices > Default configuration to display the corresponding view and customize the Microservice
configuration as needed.
Configuration is not applied when running Microservices in the Studio. For example, custom servlet context path is not used and management endpoints are not available.
-
In the tree to the left of the dialog box, select Log4j to display the corresponding view.
-
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 Log4jXmlFormat.
A sample Log4j configuration is shown below which will also provide a tesb.log file when the Microservice is started. Note that the Log4j configuration is the same for Talend Studio and the 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>
-
If the Route contains the cSOAP or
cREST component, you need to use relative endpoint URL
instead of absolute URL. The REST and Soap services run in the default port defined
in the Default configuration. 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.
Environment variables to use for Basic Authentication are MS_SECURITY_USER_NAME and MS_SECURITY_USER_PASSWORD.
-
Open the Route in the design work space. In the Deployment
view of the Route tab, select
Microservice in the Build Type list.
Save the Route.
-
In the Repository tree view, right-click the Route you want
to build, and select Build Route to open the dialog box.
- In the To archive file field, browse to the directory where you want to save your built Route.
- 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.
- In the Build Type area, select Microservice.
-
In the options area:
-
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.
- select the Enable Prometheus metrics endpoint check box to build the Prometheus metrics endpoint into the Microservice to monitor the execution of Routes, 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.
-
-
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 Talend Studio log file <Studio_Home>\workspace\.metadata\.log.
Results
A .jar or .zip file for the Route is created in the defined place. You can run it independently of Talend Studio in standalone mode.
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!