Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreAfter a long and exciting journey, we are pleased to announce the General Availability release of the Spring Cloud Stream Elmhurst release train - Elmhurst.RELEASE/2.0.0.RELEASE.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-dependencies</artifactId>
<version>Elmhurst.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Spring Cloud Stream Elmhurst (2.0.0.RELEASE) is available for use in Maven Central and the Spring Repo. The release notes include relevant information about version compatibility with Spring Boot, Spring Cloud, Spring AMQP, and Spring for Apache Kafka.
Spring Cloud Stream 2.0 includes a complete revamp of content-type negotiation functionality to address performance, flexibility, and, most importantly, consistency. The recently published blog touches on some of the key points around what has been done, what to expect, and how it may help you. More information can be found in the Content Type Negotiation section of the reference guide.
As described in the previous section, a significant amount of work went into simplifying content-type negotiation and Message Conversion. As a result of this work, we now support user-defined message converters (through Spring's standard org.springframework.messaging.converter.MessageConverters
) being registered for cases where the provided message conversion functionality isn't enough. You can register custom a message converter by using @StreamMessageConverter
, as shown below:
@Bean
@StreamMessageConverter
public FooBarMessageConverter fooBarMessageConverter() {
return new FooBarMessageConverter(MimeType.valueOf("foo/bar"));
}
public static class FooBarMessageConverter extends AbstractMessageConverter {
. . .
}
More information can be found in the User-defined Message Converters section of the reference guide.
Polling Consumer feature lets you control the rate of message consumption, and the recently published blog from Gary Russell provides additional information, which could be boiled down to two simple steps:
@Input
PollableMessageSource inputSource();
@Autowire
PollableMessageSource inputSource;
. . .
inputSource.poll(System.out::println);
More information can be found in the Using Polled Consumers section of the reference guide.
To simplify the footprint and to provide greater flexibility with regard to the choice of web frameworks (imperative versus webflux), we've made both Spring Boot Actuator and Web optional dependencies and do not include them by default. However, you can add them as application dependencies if you need to, by including the following dependency elements:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
You can now both visualize as well as control bindings by using new actuator endpoints.
Set the management.endpoints.web.exposure.include=bindings
Boot property and enable one of the web frameworks and actuator by including their respective starters as dependencies in your project (as described in Actuator and Web Are Now Optional)
Start your application and access the following URL to visualize the current bindings: http://localhost:8080/actuator/bindings
From that URL, you can receive output similar to the following:
[
{
name: "myDestination",
group: "myGroup",
pausable: false,
state: "running",
extendedInfo: {
bindingDestination: "RabbitConsumerDestination{queue=Queue [name=myDestination.myGroup, durable=true, . . .}",
ExtendedConsumerProperties: {
concurrency: 1,
instanceCount: 1,
maxAttempts: 3,
backOffInitialInterval: 1000,
backOffMaxInterval: 10000,
backOffMultiplier: 2,
extension: {
exchangeType: "topic",
declareExchange: true,
. . .
You can also visualize individual bindings as well as control their lifecycle (such as stop, start, pause, and resume). More details can be found in the Binding Visualization and Control section of the user guide.
Since Boot 2.0, the metrics support has been based on Micrometer.
While Micrometer captures application metrics, Spring Cloud Stream provides support for publishing those application metrics to a predefined destination (such as a Rabbit exchange or a Kafka topic).
By setting the spring.cloud.stream.bindings.applicationMetrics.destination=myMetricDestination
property, you are requesting to publish metric messages to myMetricDestination
.
The published message is in JSON format and looks similar to the following:
{
"name": "application",
"createdTime": "2018-03-23T14:48:12.700Z",
"properties": {
},
"metrics": [
{
"id": {
"name": "spring.integration.send",
"tags": [
. . .
{
"key": "name",
"value": "input"
},
. . .
{
"key": "type",
"value": "channel"
}
],
"type": "TIMER",
"description": "Send processing time",
"baseUnit": "milliseconds"
},
"timestamp": "2018-03-23T14:48:12.697Z",
"sum": 130.340546,
"count": 6,
"mean": 21.72342433333333,
"upper": 116.176299,
"total": 130.340546
}
]
}
One of the consumers of this information is Spring Cloud Dataflow and its UI, which shows message rates as well as other metric data. More details can be found in the Metrics Emitter section of the reference guide.
Our own Soby Chacko has done amazing work to provide enhanced support for building streaming applications with Apache Kafka Streams. Some of the core features worth mentioning are:
KStream
and KTable
) as bindable componentsJust as we were finishing up with this new feature, our relentless colleague and friend, Josh Long, compiled a quick demo/tutorial demonstrating some of the tips and tricks of building streaming applications with Kafka Streams and Spring Cloud Stream.
This new Quick Start guide was specifically designed to take no more then 5 min and requires little to no prior knowledge or experience with Spring Cloud Stream. It also showcases some of the Spring Initializr updates related to Spring Cloud Stream 2.0 and Spring Boot 2.0.
Once comfortable with the core concepts, feel free to venture out and use our extensive and ever growing library of samples showcasing conventional as well as reactive style streaming applications.
If you want to learn about the role of Spring Cloud Stream as a building block of the directional data pipelines in Spring Cloud Dataflow, we highly recommend Real-time Object-Detection With Spring Cloud Stream from our own Christian Tzolov.
Our community has grown.
Whether its participation in the public forum discussion (such as Stack Overflow, Gitter, and others) or code contributions in GitHub, your participation is invaluable and much appreciated. Consequently, we would like to take this opportunity to recognize the following GitHub users and their contributions that came in a form of the GutHib pull requests: @jmax01
, @JacobASeverson
, @davidkalosi
, @oatesp
, @aldex32
, @bewithvk
, @rzukow
, @iNikem
, @Delmonte3161
, @hekonsek
, and many more.
We would also like to call out a community effort led by our own Artem Bilan for doing their part in supporting the AWS Kinesis binder.
If you want to raise issues or make a contribution feel free to reach us at the GitHub project sites: