简介:
Spring Cloud Stream is a framework for building highly scalable event-driven microservices connected with shared messaging systems.
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.
Spring Cloud Stream是一个框架,用于构建连接到共享消息传递系统的高度可伸缩的事件驱动微服务。
该框架提供了一个灵活的编程模型,它建立在已经建立和熟悉的Spring习惯用法和最佳实践之上,包括对持久发布/子语义、消费者组和有状态分区的支持。
环境准备:Consul注册中心和RabbitMQ
POM
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>