Spring Cloud Stream Reference Guide

Authors

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, Soby Chacko, Vinicius Carvalho, Gary Russell, Oleg Zhurakousky

Elmhurst.RC3

Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.


Table of Contents

I. Spring Cloud Stream Core
1. Quick Start
1.1. Step One - Create sample Application using Spring Initilaizer
1.2. Step Two - Import project into the IDE
1.3. Step Three - Add message handler, build and run
2. What’s New in 2.0?
2.1. New Features and Components
2.1.1. Polling Consumer
2.1.2. Micrometer support
2.1.3. New Actuator Binding controls
2.1.4. Configurable RetryTemplate
2.2. Notable changes and enhancements
2.2.1. Both Actuator and Web dependencies are now optional
2.2.2. Content-type negotiation improvenents
2.3. Notable Deprecations
2.3.1. Java serialization (Java native and Kryo)
2.3.2. Deprecated classes and methods
3. Introducing Spring Cloud Stream
4. Main Concepts
4.1. Application Model
4.1.1. Fat JAR
4.2. The Binder Abstraction
4.3. Persistent Publish-Subscribe Support
4.4. Consumer Groups
4.5. Consumer Types
4.5.1. Durability
4.6. Partitioning Support
5. Programming Model
5.1. Declaring and Binding Producers and Consumers
5.1.1. Triggering Binding Via @EnableBinding
5.1.2. @Input and @Output
Customizing Channel Names
Source, Sink, and Processor
5.1.3. Accessing Bound Channels
Injecting the Bound Interfaces
Injecting Channels Directly
5.1.4. Producing and Consuming Messages
Native Spring Integration Support
Spring Integration Error Channel Support
Message Channel Binders and Error Channels
Using @StreamListener for Automatic Content Type Handling
Using @StreamListener for dispatching messages to multiple methods
Using Polled Consumers
5.1.5. Reactive Programming Support
Reactor-based handlers
Reactive Sources
5.1.6. Aggregation
Configuring aggregate application
Configuring binding service properties for non self contained aggregate application
6. Binders
6.1. Producers and Consumers
6.2. Binder SPI
6.3. Binder Detection
6.3.1. Classpath Detection
6.4. Multiple Binders on the Classpath
6.5. Connecting to Multiple Systems
6.6. Binding visualization and control
6.7. Binder configuration properties
7. Configuration Options
7.1. Spring Cloud Stream Properties
7.2. Binding Properties
7.2.1. Properties for Use of Spring Cloud Stream
7.2.2. Consumer properties
7.2.3. Producer Properties
7.3. Using dynamically bound destinations
8. Content Type negotiation
8.1. Introduction
8.2. Mechanics
8.2.1. Content type vs. argument type
8.2.2. Message Converters
8.3. Provided MessageConverters
8.4. User defined Message Converters
9. Schema evolution support
9.1. Apache Avro Message Converters
9.2. Converters with schema support
9.3. Schema Registry Support
9.4. Schema Registry Server
9.4.1. Schema Registry Server API
9.5. Schema Registry Client
9.5.1. Using Confluent’s Schema Registry
9.5.2. Schema Registry Client properties
9.6. Avro Schema Registry Client Message Converters
9.6.1. Avro Schema Registry Message Converter properties
9.7. Schema Registration and Resolution
9.7.1. Schema Registration Process (Serialization)
9.7.2. Schema Resolution Process (Deserialization)
10. Inter-Application Communication
10.1. Connecting Multiple Application Instances
10.2. Instance Index and Instance Count
10.3. Partitioning
10.3.1. Configuring Output Bindings for Partitioning
Configuring Input Bindings for Partitioning
11. Testing
11.1. Disabling the test binder autoconfiguration
12. Health Indicator
13. Metrics Emitter
14. Samples
14.1. Deploying Stream applications on CloudFoundry
II. Binder Implementations
15. Apache Kafka Binder
15.1. Usage
15.2. Apache Kafka Binder Overview
15.3. Configuration Options
15.3.1. Kafka Binder Properties
15.3.2. Kafka Consumer Properties
15.3.3. Kafka Producer Properties
15.3.4. Usage examples
Example: Setting autoCommitOffset false and relying on manual acking.
Example: security configuration
Example: Pausing and Resuming the Consumer
15.4. Error Channels
15.5. Kafka Metrics
15.6. Dead-Letter Topic Processing
15.7. Partitioning with the Kafka Binder
16. Apache Kafka Streams Binder
16.1. Usage
16.2. Kafka Streams Binder Overview
16.2.1. Streams DSL
16.3. Configuration Options
16.3.1. Kafka Streams Properties
16.3.2. TimeWindow properties:
16.4. Multiple Input Bindings
16.4.1. Multiple Input Bindings as a Sink
16.4.2. Multiple Input Bindings as a Processor
16.5. Multiple Output Bindings (aka Branching)
16.6. Message Conversion
16.6.1. Outbound serialization
16.6.2. Inbound Deserialization
16.7. Error Handling
16.7.1. Handling Deserialization Exceptions
16.7.2. Handling Non-Deserialization Exceptions
16.8. Interactive Queries
17. RabbitMQ Binder
17.1. Usage
17.2. RabbitMQ Binder Overview
17.3. Configuration Options
17.3.1. RabbitMQ Binder Properties
17.3.2. RabbitMQ Consumer Properties
17.3.3. Rabbit Producer Properties
17.4. Retry With the RabbitMQ Binder
17.4.1. Overview
17.4.2. Putting it All Together
17.5. Error Channels
17.6. Dead-Letter Queue Processing
17.6.1. Non-Partitioned Destinations
17.6.2. Partitioned Destinations
republishToDlq=false
republishToDlq=true
17.7. Partitioning with the RabbitMQ Binder
III. Appendices
A. Building
A.1. Basic Compile and Test
A.2. Documentation
A.3. Working with the code
A.3.1. Importing into eclipse with m2eclipse
A.3.2. Importing into eclipse without m2eclipse
A.4. Sign the Contributor License Agreement
A.5. Code Conventions and Housekeeping