Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreI’m pleased to announce that the Java DSL for Spring Integration 1.2 M1
is available now!
First of I’d like to thank everyone who created issues, raised Pull Requests, provided feedback or just asked questions on StackOverflow. Without the community we couldn’t be the successful project we are today!
The artifact org.springframework.integration:spring-integration-java-dsl:1.2.0.M1
is available in the Milestone repo. So, give it a shot and don’t hesitate to raise a GH issue for any feedback!
Some highlights of the current iteration:
Based on the recently released Spring for Apache Kafka project, a new Kafka09
factory has been introduced. This is straightforward Java DSL factory for producing IntegrationComponentSpec
fluent API builders for adapters based on the a Spring for Apache Kafka foundation. An existing Kafka
factory for Apache Kafka 0.8
support is still present for backward compatibility.
In many cases it would be better to specify an integration flow based on the system state or even during some business function invocation. Or even make it volatile after execution. For this purpose an IntegrationFlowContext
component has been introduced to let the manual IntegrationFlow
control.
@Autowired
private IntegrationFlowContext context;
...
IntegrationFlow myFlow = f -> f
.<String, String>transform(String::toUpperCase)
.transform("Hello, "::concat);
String flowId = this.context.register(myFlow);
MessagingTemplate messagingTemplate = this.context.messagingTemplateFor(flowId);
assertEquals("Hello, SPRING",
messagingTemplate.convertSendAndReceive("spring", String.class));
this.context.remove(flowId);
See IntegrationFlowContext
JavaDocs for more information.
For convenience to log the message journey Spring Integration manner (a-la <logging-channel-adapter>
), a new log()
operator has been introduced. Underneath it is represented just by WireTap
ChannelInterceptor
and LoggingHandler
as subscriber. It is responsible to log message incoming into the next endpoint:
.filter(...)
.log(LoggingHandler.Level.ERROR, "test.category", m -> m.getHeaders().getId())
.route(...)
In this example an id
header will be logged with ERROR
level onto "test.category" only for messages passed the filter and before routing.
A .wireTap()
fluent API has been introduced for MessageChannelSpec
builders. Now a target configuration gains much more from Java DSL usage:
@Bean
public QueueChannelSpec myChannel() {
return MessageChannels
.queue()
.wireTap("loggingFlow.input");
}
@Bean
public IntegrationFlow loggingFlow() {
return f -> f.log();
}
Having a pure Java instantiation for beans it really looks enough organic to have routing keys as any desired type and avoid converting to String
everything. Plus the type relaxing let us have configuration as generic-aware:
@Bean
public IntegrationFlow payloadTypeRouteFlow() {
return f -> f
.<Object, Class>route(Object::getClass, m -> m
.channelMapping(String.class, "stringsChannel")
.channelMapping(Integer.class, "integersChannel"));
}
See commit history for 1.2.0.M1
version for more information.
The maintenance version 1.1.3
has been also release with several nasty bug fixes and Spring Integration 4.3 compatibility. The org.springframework.integration:spring-integration-java-dsl:1.1.3.RELEASE
artifact is available in the repo.spring.io and Maven Central. It is recommended to upgrade for everyone, especially if you use JMS
factory and beans which implement ApplicationListener
.
We expect the next Milestone 2 for version 1.2
enough soon, over a couple weeks, with an RC and release somewhere in the middle of August. At the same time we are going to absorb spring-integration-java-dsl
project into Spring Integration Core with version 5.0
and Java 8 code base. The current 1.2
version will be still supported, but just for bug fixes.
Project Page | Documentation | Issues | Help