Spring Cloud Stream

Spring Cloud Stream is a framework for building message-driven microservices. Spring Cloud Stream builds upon Spring Boot to create DevOps friendly microservice applications and Spring Integration to provide connectivity to message brokers. Spring Cloud Stream provides an opinionated configuration of message brokers, introducing the concepts of persistent pub/sub semantics, consumer groups and partitions across several middleware vendors. This opinionated configuration provides the basis to create stream processing applications.

By adding @EnableBinding to your main application, you get immediate connectivity to a message broker and by adding @StreamListener to a method, you will receive events for stream processing.

Quick Start
Fork me on GitHub

Quick Start


The recommended way to get started using spring-cloud-stream in your project is 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 are on the classpath any Spring Boot application with @EnableBinding will bind to an external broker provided by the bus (e.g. Rabbit MQ or Kafka, depending on the implementation you choose). Sample application:

Head over to http://start.spring.io and create a project with the 'Stream Kafka' dependency. Modify the main class as shown below:

public class StreamdemoApplication {

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

    @InboundChannelAdapter(value = Source.OUTPUT)
    public MessageSource<String> timerMessageSource() {
        return () -> new GenericMessage<>(new SimpleDateFormat().format(new Date()));


Make sure Kafka is running when you run the application. You can use the kafka-console-consumer.sh utility provided by Kafka to monitor messages sent on the output topic.