Using Spring configuration - Cloud - 7.3

Talend Studio User Guide

Version
Cloud
7.3
Language
English
Product
Talend Big Data
Talend Big Data Platform
Talend Cloud
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development
Last publication date
2024-02-13
Available in...

Cloud API Services Platform

Cloud Data Fabric

Data Fabric

Data Services Platform

ESB

MDM Platform

Real-Time Big Data Platform

Spring is an application development framework for enterprise Java. Apache Camel is designed to work nicely with the Spring Framework. The Route designer of Talend Studio allows you to add a Spring context to a Route for configuration purpose. You can define beans and resources in Spring XML DSL and then use them in Routes. This makes it possible for developers to combine Java and Spring codes in the configuration of Routes. It is particularly useful when there is no explicit component available in the palette.

To be able to use the Spring configuration, your knowledge of Spring is required. For more information about Spring, see Spring website.

To add a Spring context to a Route, you need first to create the Route. For more information about how to create a Route, see Creating a Route.

The Spring tab is located in the lower half of the design workspace. When you create a Route in the design workspace, a default Spring configuration is set in the Spring view.

By default, the Apache Camel JMX Notification is declared in the Spring configuration. You can configure it as needed and call it in the Route.

Enter the code you want to implement in this view. The screenshot above shows an example of using a bean to call a previously defined Route Resource named RouteWithSpring:

<bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">
    <property name="location" value="classpath:RouteWithSpring.properties"/>
</bean>

For more information about creating and using Route Resources, see Using Route Resources.

The following code gives another example that defines a message routing from the endpoint vm:a to log:vm:

<camel:camelContext>
	<camel:route>
		<camel:from uri="vm:a" />
		<camel:to uri="log:vm" />
	</camel:route>
</camel:camelContext>

When you export a Route, the Spring XML file will be also exported in the KAR file.

Click the Restore Default button to change back to the default Spring configuration.

For a real-life use case of how to use Spring configuration in a Route, see the scenario provided for cSEDA in SEDA (Mediation).

Warning:

When the Spring configuration is wrong, the Route may fail to start.