Retry logic based on specific errors with various options for back-offs.With a few lines of configuration, an application can support: Spring Cloud Stream makes it very easy to configure common binding properties regardless of the broker. Spring Cloud Stream has a great Quick Start guide that I recommend for getting introduced to the project. The functions can even be composed together to create complex workflows, and since it is done with configuration, Spring Cloud allows these to be changed on the fly! This can be done completely with configuration (no boilerplate code!). Define any number of Function s, Consumer s, or Supplier s as Spring beans, and these can be configured as streamers, consumers, or producers of messages respectively. Consumers, Producers, and Streamers of data can be defined with Java’s functional interface. One of the key concepts of Spring Cloud Stream is its functional paradigm. You should check the specific documentation for the binder(s) if you need this information.
Spring’s documentation does a good job of explaining the concept of a binder and how to configure one.Įach binder implementation contains configuration options for setting up features specific to it, such as concurrency, partitioning, and error handling. (Note, in Spring Cloud Stream, the term destination is used to refer to an input or output source of messages. An application can use more than one binder if it has multiple message destinations. The application core only needs to interact with a canonical message.īinders can be used on both the input and output side to interact with producers or consumers of data.
This abstraction allows your code to be middleware-neutral, focusing only on core business logic. Consumer Groups (horizontal scaling of a single consumer)Ī binder handles the integration with a single framework.Publish/Subscribe (multiple consumers of the same data).The binders support the core features of modern messaging/eventing systems: At the time of publication, there were binders for Apache Kafka, Kafka Streams, Rabbit MQ, Azure Event Hubs, Google Cloud PubSub, and many others ( see the list). Spring Cloud Stream relies on the concept of a binder to handle the integration with a messaging or event streaming framework. Spring Cloud Stream evolved out of the Spring Integration project as it embraced Spring Boot and moved into the modern cloud era. Simplified testing with an improved test binder.Functional paradigm for message processing through spring-cloud-function.There are two in particular that I want to focus on. Recently, Spring Cloud Stream introduced several new features that have made it an easy option for processing asynchronous messaging streams. “The framework provides a 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.” ( reference) “Spring Cloud Stream is a framework for building highly scalable event-driven microservices connected with shared messaging systems. Recently, I have had some time to explore Spring Cloud Stream, and I have come to find that it has many advantages over other frameworks. Modern platforms and frameworks have made writing asynchronous messaging systems very easy.
Support of backpressure around system bottlenecks.Ability to scale various portions of the workflow differently as needed.Offloading of workflows to provide an immediate response to a user.Maximization of throughput - especially in cases where immediate consistency is not required.Writing asynchronous messaging applications and eventually-consistent systems provides many advantages, including: