Spring Cloud Stream

Spring Cloud Stream is a framework for building highly scalable event-driven microservices connected with shared messaging systems.

The framework provides flexible programming model built on already established and familiar Spring idioms and best practices, including support for persistent pub/sub semantics, consumer groups, and stateful partitions.

Quick Start
Fork me on GitHub

The core building blocks of Spring Cloud Stream are:

  • Destination Binders: Components responsible to provide integration with the external messaging systems.
  • Destination Bindings: Bridge between the external messaging systems and application provided Producers and Consumers of messages (created by the Destination Binders).
  • Message: The canonical data structure used by producers and consumers to communicate with Destination Binders (and thus other applications via external messaging systems).

Spring Cloud Stream overview

Binder Implementations

Spring Cloud Stream supports a variety of binder implementations and the following table includes the link to the GitHub projects.

Apache Kafka
Amazon Kinesis
Google PubSub (partner maintained)
Solace PubSub+ (partner maintained)
Azure Event Hubs (partner maintained)

Quick Start


The recommended way to get started with spring-cloud-stream is to use Spring Initializr. Just follow these instructions. You can also start using it in your project with a dependency management system – the snippet below can be copied and pasted into your build. Need help? See our getting started guides on building with Maven and Gradle.

As long as Spring Cloud Stream and a Spring Cloud Stream Binder dependencies are on the classpath any Spring Boot application with @EnableBinding binds to the external messaging system (e.g. Rabbit MQ or Apache Kafka, depending on the binder-implementation of choice).

For more comprehansive step-by-step getting started experience please refer to the Quick Start section of the user guide.

Below is the fully functional Spring Cloud Stream application, which receives and logs data to the console.

public class LoggingConsumerApplication {

	public static void main(String[] args) {
		SpringApplication.run(LoggingConsumerApplication.class, args);

	public void handle(Person person) {
		System.out.println("Received: " + person);

	public static class Person {
		private String name;
		public String getName() {
			return name;
		public void setName(String name) {
			this.name = name;
		public String toString() {
			return this.name;

As you can see from the preceding example:

  • We've enabled Sink binding (input-no-output) by using @EnableBinding(Sink.class). Doing so signals to the framework to initiate binding to the messaging system, where it automatically creates the destination (that is, queue, topic, and others) that are bound to the Sink.INPUT channel.

  • We've added a handler method to receive incoming messages of type Person. Doing so lets you see one of the core features of the framework: It tries to automatically convert incoming message payloads to type Person.

You can start the application by simply running its main(..) method.

Apache Kafka Client Compatibility

Spring Cloud Stream supports a variety of Apache Kafka Client releases. To learn more about it, please refer to the Apache Kafka Client Compatibility section in the Wiki page.