Spring Integration Java DSL 1.1 M2 is Available

Releases | Artem Bilan | September 10, 2015 | ...

We are pleased to announce that the Milestone 2 of Spring Integration Java DSL is now available from the Milestone Repository:

For Gradle use this:

compile "org.springframework.integration:spring-integration-java-dsl:1.1.0.M2"

For Maven this:

<dependency>
     <groupId>org.springframework.integration</groupId>
     <artifactId>spring-integration-java-dsl</artifactId>
     <version>1.1.0.M2</version>
</dependency>

There are not many new features since Milestone 1, but here are the most important things to which to pay attention:

Spring Integration 4.2 foundation

The Spring Integration Java DSL 1.1 is now based on Spring Integration 4.2 to become part of the upcoming Spring IO 2.0. The 1.1 version of the Java DSL is no longer compatible with Spring Integration 4.1.x.

Spring Integration Kafka 1.2.x upgrade

We now provide the Kafka Namespace Factory for the Spring Integration Kafka Adapters. The new Spring Integration Kafka 1.2 release together with the upgrade to Apache Kafka 0.8.2 brings a number of breaking changes. Hence this Java DSL Milestone 2 of 1.1 is no longer compatible with the previous version of Spring Integration Kafka and Apache Kafka respectively.

HTTP Namespace Factory

The Spring Integration HTTP Adapters are now covered with their specific Http Namespace Factory. Please, meet our classical HTTP Proxy sample, but on Java DSL already:

@Bean
public IntegrationFlow httpProxyFlow() {
    return IntegrationFlows
        .from((MessagingGateways g) ->
               g.httpGateway("/proxy")
                     .requestMapping(r -> r.params("name"))
                     .payloadFunction(httpEntity ->
                           ((ServletRequestAttributes) RequestContextHolder
                                                     .currentRequestAttributes())
						.getRequest()
						.getQueryString()))
        .handleWithAdapter(a ->
              a.httpGateway(m ->
                   String.format("http://target/service?%s", m.getPayload()))
                              .expectedResponseType(String.class))
        .get();
}

Reactive Streams Support

We are pleased to announce that Spring Integration is beginning to provide integration with Reactive Streams and support for Publisher is presented in the Java DSL directly:

@Bean
public Publisher<Message<String>> reactiveFlow() {
	return IntegrationFlows
		.from(() -> new GenericMessage<>("a,b,c,d,e,f"))
		.split(String.class, p -> p.split(","))
		.toReactivePublisher();
}

As you see it is simple to go from the Spring Integration world to the Reactive Streams world. The org.reactivestreams.Publisher bean can be used afterwards as an event source for the Reactive program, e.g. using the Project Reactor implementation:

@Autowired
@Qualifier("reactiveFlow")
private Publisher<Message<String>> publisher;
....
List<String> results = new ArrayList<>();
CountDownLatch latch = new CountDownLatch(6);
Streams.wrap(this.publisher)
	.map(m -> m.getPayload().toUpperCase())
	.consume(p -> {
			results.add(p);
			latch.countDown();
		});

The other direction - from Reactive Stream to the Spring Integration - is simple enough, too (from Reactor perspective):

.consume(v -> messagingTemplate().convertAndSend(reactorStreamResult(), v));

We will consider some org.reactivestreams.Subscriber option for the MessageChannel implementation in the future release.

Other changes

There have been done other important refactoring and deprecations to make the DSL more fluent, convenient and flexible, such as:

  • The Files.splitter() factory method for the FileSplitter component;
  • The (S)Ftp.outboundGateway() for new MessageSessionCallback (a Spring Integration 4.2 feature);
  • Refactored and improved .aggregate() and .resequence() EIP-methods etc.

##SpringOne 2GX 2015 is around the corner! Book your place at SpringOne2GX in Washington, DC next week. It’s simply the best opportunity to find out first hand all that’s going on and to provide direct feedback.

Come to my talk to get more information from the first hands of Spring Integration Java DSL and help me to make this Framework better!

Project Page | JIRA | Issues | [Contributions] (https://github.com/spring-projects/spring-integration/blob/master/CONTRIBUTING.md) | StackOverflow (spring-integration tag)

Get the Spring newsletter

Thank you for your interest. Someone will get back to you shortly.

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring Runtime offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all