Add DSL Reference and Quick Start

This commit is contained in:
Gary Russell
2014-11-25 13:18:27 -05:00
parent fea6edad3a
commit 8cc7efdf78

View File

@@ -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 DZones 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="'&lt;FahrenheitToCelsius xmlns=''http://tempuri.org/''&gt;&lt;Fahrenheit&gt;XXX&lt;/Fahrenheit&gt;&lt;/FahrenheitToCelsius&gt;'.replace('XXX', payload.toString())" />
expression="'&lt;FahrenheitToCelsius xmlns=''http://www.w3schools.com/webservices/''&gt;&lt;Fahrenheit&gt;XXX&lt;/Fahrenheit&gt;&lt;/FahrenheitToCelsius&gt;'.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 %}