From 8cc7efdf78247e327eb6e4571b21d8e4c52786a0 Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Tue, 25 Nov 2014 13:18:27 -0500 Subject: [PATCH] Add DSL Reference and Quick Start --- index.html | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index e83ec67bac..8c74043ba8 100644 --- a/index.html +++ b/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) +

News:

+[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 { + expression="'<FahrenheitToCelsius xmlns=''http://www.w3schools.com/webservices/''><Fahrenheit>XXX</Fahrenheit></FahrenheitToCelsius>'.replace('XXX', payload.toString())" /> - + @@ -144,6 +149,49 @@ public interface TempConverter { ```` +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 -> + "" + + "" + payload +"" + + "") + .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 %}