赞
踩
整个流程中,只有发送/接收端从context上下文中取事件和发送事件是需要我们在代码中明确写出来的,其它部分都由框架封装完成。
Spring Cloud Stream Application
持久化
Binding
分区支持
订阅/发布
消息的发布(Publish)和订阅(Subscribe)是事件驱动的经典模式
消费者分组
spring.cloud.stream.bindings.<channelName>.group = xxx
下图中Stream 的消费者分组设置,属性值分别设置为
spring.cloud.stream.bind-ings.<channelName>.group=hdfsWrite
spring.cloud.stream.bindings.<channelName>.group=average.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
server: port: 8904 spring: application: name: config-server cloud: config: server: git: uri: https://gitee.com/xxx.git username: test password: 123456 clone-on-start: true # 开启启动时直接从git获取配置 rabbitmq: #rabbitmq相关配置 host: localhost port: 5672 username: guest password: guest eureka: client: service-url: defaultZone: http://localhost:8001/eureka/ management: endpoints: #暴露bus刷新配置的端点 web: exposure: include: 'bus-refresh'
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
server: port: 9004 spring: application: name: config-client cloud: config: profile: dev #启用环境名称 label: dev #分支名称 name: config #配置文件名称 discovery: enabled: true service-id: config-server rabbitmq: #rabbitmq相关配置 host: localhost port: 5672 username: guest password: guest eureka: client: service-url: defaultZone: http://localhost:8001/eureka/ management: endpoints: web: exposure: include: 'refresh'
# 修改前信息
config:
info: "config info for dev(dev)"
# 修改后信息
config:
info: "update config info for dev(dev)"
update config info for dev(dev)
http://localhost:8904/actuator/bus-refresh/{destination}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。