Add DSL Reference and Quick Start
This commit is contained in:
54
index.html
54
index.html
@@ -42,7 +42,12 @@ and scheduling. Spring Integration's primary goal is to provide a simple model f
|
||||
integration solutions while maintaining the separation of concerns that is essential for producing
|
||||
maintainable, testable code.
|
||||
|
||||
[Pivotal Recognized in DZone’s 2014 Guide to Enterprise Integration.](https://spring.io/blog/2014/11/12/pivotal-recognized-in-dzone-s-2014-guide-to-enterprise-integration)
|
||||
<h4>News:</h4>
|
||||
[Pivotal Recognized in DZone's 2014 Guide to Enterprise Integration.](https://spring.io/blog/2014/11/12/pivotal-recognized-in-dzone-s-2014-guide-to-enterprise-integration)
|
||||
|
||||
Check out the new [Java DSL for configuring your integration flows with a fluent Java API](https://spring.io/blog/2014/11/24/spring-integration-java-dsl-1-0-ga-released) and the [line-by-line tutorial using a DSL version of the classic 'Cafe' application.](https://spring.io/blog/2014/11/25/spring-integration-java-dsl-line-by-line-tutorial)
|
||||
|
||||
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
@@ -133,9 +138,9 @@ public interface TempConverter {
|
||||
|
||||
<int:chain id="wsChain" input-channel="viaWebService">
|
||||
<int:transformer
|
||||
expression="'<FahrenheitToCelsius xmlns=''http://tempuri.org/''><Fahrenheit>XXX</Fahrenheit></FahrenheitToCelsius>'.replace('XXX', payload.toString())" />
|
||||
expression="'<FahrenheitToCelsius xmlns=''http://www.w3schools.com/webservices/''><Fahrenheit>XXX</Fahrenheit></FahrenheitToCelsius>'.replace('XXX', payload.toString())" />
|
||||
<int-ws:header-enricher>
|
||||
<int-ws:soap-action value="http://tempuri.org/FahrenheitToCelsius"/>
|
||||
<int-ws:soap-action value="http://www.w3schools.com/webservices/FahrenheitToCelsius"/>
|
||||
</int-ws:header-enricher>
|
||||
<int-ws:outbound-gateway
|
||||
uri="http://www.w3schools.com/webservices/tempconvert.asmx"/>
|
||||
@@ -144,6 +149,49 @@ public interface TempConverter {
|
||||
</int:chain>
|
||||
````
|
||||
|
||||
And here is the same application (web service part) using the [new Java DSL](https://spring.io/blog/2014/11/24/spring-integration-java-dsl-1-0-ga-released) (and Spring Boot):
|
||||
|
||||
````java
|
||||
@Configuration
|
||||
@SpringBootApplication
|
||||
@IntegrationComponentScan
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ConfigurableApplicationContext ctx = SpringApplication.run(Application.class, args);
|
||||
TempConverter converter = ctx.getBean(TempConverter.class);
|
||||
System.out.println(converter.fahrenheitToCelcius(68.0f));
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
@MessagingGateway
|
||||
public interface TempConverter {
|
||||
|
||||
@Gateway(requestChannel = "convert.input")
|
||||
float fahrenheitToCelcius(float fahren);
|
||||
|
||||
}
|
||||
|
||||
@Bean
|
||||
public IntegrationFlow convert() {
|
||||
return f -> f
|
||||
.transform(payload ->
|
||||
"<FahrenheitToCelsius xmlns=\"http://www.w3schools.com/webservices/\">"
|
||||
+ "<Fahrenheit>" + payload +"</Fahrenheit>"
|
||||
+ "</FahrenheitToCelsius>")
|
||||
.enrichHeaders(h -> h
|
||||
.header(WebServiceHeaders.SOAP_ACTION,
|
||||
"http://www.w3schools.com/webservices/FahrenheitToCelsius"))
|
||||
.handle(new SimpleWebServiceOutboundGateway(
|
||||
"http://www.w3schools.com/webservices/tempconvert.asmx"))
|
||||
.transform(Transformers.xpath("/*[local-name()=\"FahrenheitToCelsiusResponse\"]"
|
||||
+ "/*[local-name()=\"FahrenheitToCelsiusResult\"]"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
````
|
||||
|
||||
{% endcapture %}
|
||||
|
||||
{% capture related_resources %}
|
||||
|
||||
Reference in New Issue
Block a user