Cannot enable /monitor endpoint for spring-cloud-bus for push notifications

拈花ヽ惹草 提交于 2020-01-17 03:34:14

问题


I have configured spring cloud config to read properties from a git repository.With the current implementation if there is a change in the configuration, if post to /refresh on my client I am able to see the updated properties. Now, I would like to use the spring-cloud-bus-monitor to detect changes in my git repo and automatically refresh the properties in my client endpoints. Even after adding spring-cloud-config-monitor in the dependencies - the /monitor endpoint is not enabled, and therefore even when there are changes in the config properties in the config server - nothing gets refreshed.

I have a RabbitMQ server running locally as well. Appreciate any pointers on how to get the /monitor enabled to push notifications to all the clients in the bus

http://localhost:8888/monitor

{
"timestamp": 1457025362412
"status": 405
"error": "Method Not Allowed"
"exception": "org.springframework.web.HttpRequestMethodNotSupportedException"
"message": "Request method 'POST' not supported"
"path": "/monitor"
}

o.s.cloud.bus.event.RefreshListener      : Received remote refresh request. Keys refreshed []

server pom dependencies:

<dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-config-monitor</artifactId>
        <scope>test</scope>
    </dependency>
     <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-bus-amqp</artifactId>
    </dependency>

application.properties:

spring.cloud.config.server.git.uri=file:\\\C:\\Users\\spring-cloud-config
server.port=8888
spring.cloud.config.server.monitor.github=false 

pom dependency in client:

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-monitor</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
        </dependency>

回答1:


You don't say what version you are using, it's only available in Brixton (the latest is M5). Remove <scope>test</scope>.

It should be:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-config-monitor</artifactId>
</dependency>

spring-cloud-config-monitor is not required in the client.

Monitor is meant to be used by git hosting services webhooks. If you're using a filesystem you have to use the native config server profile. See here for more information.



来源:https://stackoverflow.com/questions/35778761/cannot-enable-monitor-endpoint-for-spring-cloud-bus-for-push-notifications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!