Another bit of Spring cleaning

SpringSource announces Scala DSL for Spring Integration

It's a busy old time for the SpringSource team at VMware. Another project has surfaced in the Spring Framework Portfolio, with the Spring Integration team proud to announce the first milestone release (1.0.0.M1) of the Spring Integration Scala DSL.

For quite a while now, many Scala developers have been seeking to marry together their favourite functional programming language with the established enterprise framework, yet the timing had to be right. Scala appears to be entering a stage of acceptance with the wider community (who earlier were quite quick to dismiss it) and getting Spring approval will no doubt reinforce the signal that Scala is here for good.

Oleg Zhurakousky made the announcement on the SpringSource blog, stating that Spring Integration Scala DSL was created with the following four goals in mind. They are:

  • providing a strongly-typed alternative to XML configuration for Spring Integration
  • raising awareness about Spring Integration in Scala community
  • providing first class integration with various Scala frameworks and products such as Akka
  • providing seamless integration with Java where Scala developers can still leverage their existing Java investments

The first two are undoubtedly the most important. Creating a strong workaround alternative for the old XML/Java configuration will save eons of time for Scala developers, and forging the bonds between Spring and Scala on a community-wide basis was desperately needed.

Zhurakousky does admit that SIS DSL is not itself a new EIP framework but purely a DSL that sits on top of the Java-based Spring Integration framework, so in the first milestone, the DSL itself still relies heavily on Java types from the Spring Integration API.

Yet, this first cardinal step could prove vital for Scala's transition from community-popular langauge to enteprise friendly one. Zhurakousky adds:

As it progresses through subsequent milestones, the DSL will evolve to become increasingly Scala-esque. We do believe that such close integration with the existing java API provides instant reusability, but we also recognize the benefit of providing Scala wrappers and converters over those types in the future.

Just by glancing at what the DSL does, you can tell how big an improvement it is against the older version.

Here's the Hello World, with the Java version below

val messageFlow =
     filter.using{payload: String => payload == "World"} -->
     transform.using { payload: String => "Hello " + payload} -->
     handle.using { payload: String => println(payload) }

messageFlow.send("World")
public class SpringIntegrationIntro {
 
    public static void main(String... strings ){
       ApplicationContext context =
         new ClassPathXmlApplicationContext("config.xml");
       MyGateway gateway = context.getBean(MyGateway.class);
       gateway.send("World");
    }
 
     public static interface MyGateway {
       public void send(String value);
     }
}

See, infinitely quicker. For more information on the project, check out the information on GitHub and also the two videos below detailing the reasoning for SpringSource's foray into Scala and how to get going.

Whilst on the face of it, this project may seem small, but it could be the beginings of Scala's ascent into the world of comprehensive enteprise support.

Chris Mayer

What do you think?

JAX Magazine - 2014 - 05 Exclucively for iPad users JAX Magazine on Android

Comments

Latest opinions