Spring Cloud Stream: Difference between revisions
(→Binder) |
|||
Line 22: | Line 22: | ||
* [[Spring Cloud Stream AWS Kinesis Binder|AWS Kinesis Binder]] | * [[Spring Cloud Stream AWS Kinesis Binder|AWS Kinesis Binder]] | ||
* [[Spring Cloud Stream Google Cloud PubSub Binder|Google Cloud PubSub Binder]] | * [[Spring Cloud Stream Google Cloud PubSub Binder|Google Cloud PubSub Binder]] | ||
* [[Spring Cloud Stream TestSupportBinder|TestSupportBinder]] | |||
==Destination Binding== | ==Destination Binding== |
Revision as of 21:16, 23 October 2018
External
- https://cloud.spring.io/spring-cloud-stream/
- https://cloud.spring.io/spring-cloud-stream-app-starters/
- Reference Spring Cloud Stream Core https://docs.spring.io/spring-cloud-stream/docs/Elmhurst.RELEASE/reference/htmlsingle/#_spring_cloud_stream_core
Internal
Overview
Spring Cloud Stream is a framework for building highly scalable event-driven microservices connected with shared messaging systems. Spring applications use Spring Cloud Stream libraries to bind to a messaging middleware. Spring Cloud Stream builds upon Spring Boot to create standalone production-grade applications and uses Spring Integration to provide connectivity to message brokers. The applications built with Spring Cloud Stream are middleware-neutral. Instead, the application communicates with the outside world through input and output channels injected into it by Spring Cloud Stream runtime. Channels are connected to brokers through middleware-specific Binder implementations.
Concepts
Binder
The component responsible to provide integration with external messaging systems. Available binders:
Destination Binding
Bridge between the external messaging system and application-provided Producers and Consumers of messages. The Producers and Consumers are created by the Destination Binders.
Interfaces
Source
Sink
Input and no output.
public interface Sink {
String INPUT = "input";
@Input(Sink.INPUT)
SubscribableChannel input();
}
Processor
Channel
Input Channel
An input channel funnels received messages into the application. The implementation is transparently created by Spring Cloud Stream and injected into the application.
Output Channel
Published messages leave the application via output channels. An input channel funnels received messages into the application. The implementation is transparently created by Spring Cloud Stream and injected into the application.
Destination
The destination can be a queue, topic, or others.
Message
The canonical data structure used by Producers and Consumers to communicate with Destination Binders, and thus other applications via external messaging systems.
Message Handler
Is this the same thing as the handler method?
@StreamListener(Sink.INPUT)
public void handle(...) {
...
}
Also see @StreamListener.
Annotations
- @EnableBinding - provides immediate connectivity to a message broker.
- @StreamListener - annotates a handler method to receive events for stream processing.
- @Input
- @Output