Spring Cloud Stream provides some abstractions and primitives that simplify the writing of message-driven microservices applications. This section outlines the following:
Application model of Spring Cloud stream
Binder Abstraction
Continuous publish-Subscribe support
Consumer group Support
Partition support
One pluggable binder API
Application Model
A spring Cloud stream application consists of a middleware-neutral core. The application communicates with the outside world through the input and output channels that the spring Cloud stream injects into. Channels are connected to external brokers through middleware-specific binder implementations.
SCST and Adhesives
Figure 5. Spring Cloud Stream App
Fat jar
The Spring Cloud stream application can be run from the IDE in standalone mode for testing. To run the spring Cloud stream application in production, you can use the standard Spring Boot tool provided for MAVEN or Gradle to create an executable (or "fat") JAR.
Binder Abstraction
Spring Cloud Stream provides binder implementations for Kafka and Rabbit MQ. Spring Cloud Stream also includes a testsupportbinder, which retains an unmodified channel so that the test can interact directly and reliably with the channel. You can use the Extensible API to write your own binder.
Spring Cloud Stream is configured with spring boot, and the binder abstraction allows the spring cloud stream application to have the flexibility to connect to the middleware. For example, a deployer can dynamically select the destination of a channel connection at run time (for example, Kafka topic or RABBITMQ Interchange). Such configurations can be provided in any form supported by external configuration properties and spring Boot (including application parameters, environment variables, and application.yml or application.properties files). In the receiver example that introduces the spring Cloud stream section, Setting the application properties spring.cloud.stream.bindings.input.destination to Raw-sensor-data will make it from Raw-sensor-data Kafka the theme or swap from binding to Raw-sensor-data RABBITMQ.
Spring Cloud stream automatically detects and uses the binder found in the classpath. You can use the same code to easily work with different types of middleware: only the different binders are included in the build. For more complex use cases, you can also package multiple binders in your application, choose a binder at run time, or even use a different binder for different channels.
Spring Cloud Stream Tutorial (ii) Key concepts