![](/img/trans.png)
[英]Can the Spring Cloud Config Server also push config updates to the remote git repo?
[英]Can spring cloud config server client listening new updates events ?
Spring Cloud配置服務器客戶端可以監聽新的更新事件嗎? 例如:git倉庫中的新提交->服務器發送事件->通知客戶端和調用自定義函數! 謝謝!
由於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/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.