可以弹出云配置服务器客户端监听新的更新事件吗?例如:git repository中的新提交 - >服务器发送事件 - >客户通知&自定义函数调用! 谢谢!
答案 0 :(得分:2)
由于git没有事件,你需要使用你的git服务器的webhooks。见http://cloud.spring.io/spring-cloud-static/Camden.SR6/#_push_notifications_and_spring_cloud_bus
在配置服务器上添加
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>Camden.SR6</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-monitor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amdp</artifactId>
<!-- -amqp (rabbitmq) or -kafka -->
</dependency>
<!-- ... -->
</dependencies>
然后,您需要将webhook添加到配置服务器http://<configserverurl>/monitor
在配置客户端添加
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
<!-- -amqp (rabbitmq) or -kafka -->
</dependency>
此处有更多详情https://spencergibb.netlify.com/blog/2015/09/24/spring-cloud-config-push-notifications/