Spring Cloud Stream Fishtown.M2 /2.1.0.M2 Release Announcement

We are pleased to announce the second Milestone of the Spring Cloud Fishtown release train – Fishtown.M2/2.1.0.M2.

Spring Cloud Stream Fishtown 2.1.0.M2 is available for use in the Spring Milestone repository. The release notes include relevant information about version compatibility with Spring Boot, Spring Cloud, Spring AMQP, and Spring for Apache Kafka.

The following section provides a brief summary of features and improvements included in this release.

Notable Dependency Upgrades

  • Spring Boot 2.1.0.M2 (now fully compatible with Spring Initializr)
  • Reactor Californium M2

Spring Cloud Function support

The main theme for this release is the introduction of a new programming model which uses Spring Cloud Function as an alternative for defining stream handlers and sources which can now be expressed as beans of
type .util.function.[Supplier/Function/Consumer]

To specify which functional bean to bind to the external destination(s) exposed by the bindings, you must provide spring.cloud.stream.function.definition property.

Here is the example of the Processor application exposing message handler as java.util.function.Function

@SpringBootApplication
@EnableBinding(Processor.class)
public class MyFunctionBootApp {
public static void main(String[] args) {
SpringApplication.run(MyFunctionBootApp.class, 
"--spring.cloud.stream.function.definition=toUpperCase");
}
@Bean
public Function toUpperCase() {
return s -> s.toUpperCase();
}
}

In the above you we simply define a bean of type java.util.function.Function called toUpperCase and identify it as a bean to be used as message handler
whose input and output will be bound to the external destinations exposed by the Processor binding.

Function composition

Using this programming model you can also benefit from functional composition where you can dynamically compose complex handlers from a set of simple functions.
As an example add the following function bean to the application defined above

@Bean
public Function wrapInQuotes() {
return s -> """ + s + """;
}

and modify the spring.cloud.stream.function.definition property to reflect your intention to compose a new function from both toUpperCase and wrapInQuotes.
To do so Spring Cloud Function allows you to use | (pipe) symbol. So to finish our example our property will now look like this:

--spring.cloud.stream.function.definition=toUpperCase|wrapInQuotes

Other Notable Features, Improvements & enhancements

Core

  • Improvements and enhancements around multi-binder scenarios

Rabbit Binder

  • Support for customization of the Consumer tags

Kafka Binder

  • Upgrade Kafka Client to 2.0

Quality improvements

As part of the continuing efforts to improve the code quality and to evaluate the framework components for its contract correctness, we have a new Acceptance Test project to bootstrap Spring Cloud Stream applications on Cloud Foundry and Kubernetes. These tests run multiple times in a day on a freshly repaved environment. We hope this provides a foundation for the community and customers to build more automation pipelines on target platforms.

Kinesis Binder

With this release we also want to highlight the recently release Kinesis Binder

Various other enhancements and bug fixes:
Core
Rabbit Binder
Kafka Binder

Next Steps

The M3 is planned for the end of September and will contain primarily new binding features as well as more features and improvements around to support Spring Cloud Function as a programming model.

As always, we welcome feedback and contributions, so please reach out to us on Stackoverflow or GitHub or via Gitter.

You might also like
Leave A Reply

Your email address will not be published.