diff --git a/spring-cloud-stream-core-docs/src/main/asciidoc/index-docinfo.xml b/spring-cloud-stream-core-docs/src/main/asciidoc/index-docinfo.xml index ce510697b..fe0a9c9d8 100644 --- a/spring-cloud-stream-core-docs/src/main/asciidoc/index-docinfo.xml +++ b/spring-cloud-stream-core-docs/src/main/asciidoc/index-docinfo.xml @@ -1,7 +1,7 @@ Spring Cloud Stream {spring-cloud-stream-version} - 2013-2016 + 2013-2018 Pivotal Software, Inc. diff --git a/spring-cloud-stream-core-docs/src/main/asciidoc/index.adoc b/spring-cloud-stream-core-docs/src/main/asciidoc/index.adoc index d7e739ad9..564353e00 100644 --- a/spring-cloud-stream-core-docs/src/main/asciidoc/index.adoc +++ b/spring-cloud-stream-core-docs/src/main/asciidoc/index.adoc @@ -1,6 +1,6 @@ [[spring-cloud-stream-reference]] = Spring Cloud Stream Reference Guide -Sabby Anandan; Marius Bogoevici; Eric Bottard; Mark Fisher; Ilayaperumal Gopinathan; Gunnar Hillert; Mark Pollack; Patrick Peralta; Glenn Renfro; Thomas Risberg; Dave Syer; David Turanski; Janne Valkealahti; Benjamin Klein; Vinicius Carvalho +Sabby Anandan; Marius Bogoevici; Eric Bottard; Mark Fisher; Ilayaperumal Gopinathan; Gunnar Hillert; Mark Pollack; Patrick Peralta; Glenn Renfro; Thomas Risberg; Dave Syer; David Turanski; Janne Valkealahti; Benjamin Klein; Vinicius Carvalho; Oleg Zhurakousky :doctype: book :toc: :toclevels: 4 diff --git a/spring-cloud-stream-core-docs/src/main/asciidoc/spring-cloud-stream-overview.adoc b/spring-cloud-stream-core-docs/src/main/asciidoc/spring-cloud-stream-overview.adoc index 0cd620c08..88ff8b223 100644 --- a/spring-cloud-stream-core-docs/src/main/asciidoc/spring-cloud-stream-overview.adoc +++ b/spring-cloud-stream-core-docs/src/main/asciidoc/spring-cloud-stream-overview.adoc @@ -4,6 +4,104 @@ This section goes into more detail about how you can work with Spring Cloud Stre It covers topics such as creating and running stream applications. -- +== What's New in 2.0? +Spring Cloud Stream introduces quite a number of new features, enhancements and changes. The following sections outline most notable ones. + +=== New Features and Components + +==== Polling Consumer +Introduction of _polled consumers_, where the application can control message processing rates. Please refer to the appropriate section for more details. +You can also read this blog for more details https://spring.io/blog/2018/02/27/spring-cloud-stream-2-0-polled-consumers + +==== Micrometer support + +Metrics has been switched to use https://micrometer.io/[Micrometer]. `MeterRegistry` is also provided as a bean so custom application can autowire it to capture custom metrics. +Please refer to the appropriate section for more details + +==== New Actuator Binding controls +There are now new new Actuator binding controls to bothe visulaize as well as control Bindings lifecycle. By simply enabling actuator +endpoints (e.g., --management.endpoints.web.exposure.include=*) one can now visualize bindings by simply accessing the following URL `http://:/actuator/bindings`. +One can also _stop, start, pause_ and _resume_ bindings by posting to the following URL +`curl -H "Content-Type: application/json" -X POST http://:/actuator/bindings/start/inOne` where 'inOne' is the name of the binding and 'start' is the +operation to be performed. +NOTE: _pause_ and _resume_ are only effective if corresponding binder and its underlyig technology supports it. Currently only Kafka binders support _pause_ and _resume_. + +==== Configurable RetryTemplate +Aside from providing properties to configure `RetryTemplate` we now allow you to provide your own effectively overriding the one provided by the framework. Simply configure +it as a `@Bean` in your application. + +=== Notable changes and enhancements + +==== Both Actuator and Web dependencies are now optional + +This helps to slim down the footprint of the deployed application in the event neither of the functionality is required. +It also allows one to swicth between the reactive and conventional web paradigms by adding one of the following dependencies manually: +[source,xml] +---- + + org.springframework.boot + spring-boot-starter-web + +---- +or +[source,xml] +---- + + org.springframework.boot + spring-boot-starter-webflux + +---- + +Actuator dependency can be added as follows: +[source,xml] +---- + + org.springframework.boot + spring-boot-starter-actuator + +---- + +==== Content-type negotiation improvenents +One of the core themes for 2.0 is improvements (both consistency and performance) around content-type negotiation and message conversion. +The following summary outlines notable changes and improvements. Please refer to the appropriate section for more details as well as this blog +https://spring.io/blog/2018/02/26/spring-cloud-stream-2-0-content-type-negotiation-and-transformation. + +* All message conversion is now handled *only* by `MessageConverters`. +* Introduction of `@StreamMessageConverter` annotation to provide custom `MessageConverters`. +* Introduction of the default _Content Type_ as `application/json` which needs to be taken into consideration when migrating 1.3 +application and/or operating in the mixed mode (i.e., 1.3 producer -> 2.0 consumer). +* Messages with textual payloads and _contentType_ `text/...` or `.../json` are no longer converted to `Message` for cases where argument type of the provided `MessageHandler` +can not be determnied (i.e., `public void handle(Message message)` or `public void handle(Object payload)`). Further more, a strong argument type may not be enough +to properly convert messages, so `contentType` header is may be used as supplement by some `MessageConverters`. + +=== Notable Deprecations +==== Java serialization (Java native and Kryo) +* `JavaSerializationMessageConverter` and `KryoMessageConverter`. While these two converters remain for now, they will be moved out of the core packages and support in the future. +The main reason for this deprecation is to signal the issue _type-based language-specific_ serialization couuld cause in the distributed environments, where Producers and Consumers +may not only depend on different JVM versions or have different versions of supporting libraries (i.e., Kryo), but to also draw the attention to the fact that Consumers and Producers +may and in a lot of cases are non-Java based. + +==== Deprecated classes and methods +Following is a quick summary of notable deprecations. See corresponding javadocs fort more details. + +* `SharedChannelRegistry` in favor of `SharedBindingTargetRegistry`. +* `Bindings` - beans qualified by it are already uniquely identified by their type. For example, provided `Source`, `Processor` or custom bindings: +[source,java] +---- +public interface Foo { + String OUTPUT = "fooOutput"; + + @Output(Foo.OUTPUT) + MessageChannel output(); +} +---- +* `HeaderMode.raw`. Use `none`, `headers` or `embeddedHeaders` +* `ProducerProperties.partitionKeyExtractorClass` in favor of `partitionKeyExtractorName` and `ProducerProperties.partitionSelectorClass` in favor of `partitionSelectorName`. +This is to ensure that both components are Spring configured/managed and referenced in Spring-friendly way. +* `BinderAwareRouterBeanPostProcessor` - while the component exists it is no longer a Bean Post Processor and will be renamed in the future. +* `BinderProperties.setEnvironment(Properties environment)` in favor of `BinderProperties.setEnvironment(Map environment)`. + + == Introducing Spring Cloud Stream Spring Cloud Stream is a framework for building message-driven microservice applications. Spring Cloud Stream builds upon Spring Boot to create standalone, production-grade Spring applications, and uses Spring Integration to provide connectivity to message brokers. diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractBinder.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractBinder.java index 3137cd0db..c3991fc51 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractBinder.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/AbstractBinder.java @@ -159,6 +159,10 @@ public abstract class AbstractBinder