0

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>
Swetha V
  • 300
  • 5
  • 16

1 Answers1

2

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.

spencergibb
  • 24,471
  • 6
  • 69
  • 75
  • Thank you!! That did the trick. I used Brixton build and also used a git repo instead of file system. I am yet to use a webhook to remotely push the config changes whenever there is a master branch push in GIT repo but I was able to push config changes to the client manually by doing a post. [POST]http://localhost:8888/monitor?path=demo – Swetha V Mar 03 '16 at 22:39
  • I have one question here though - would it be a performance issue if I used a wildcard for broadcasting changes to all the clients? Ex: [POST]http://localhost:8888/monitor?path=* The reason I am asking this question is - all my config property files will be in the same repo, and when I use a webhook - github will use my application url directly to push the changes when there has been a config change , and the payload url will not have a context of which file is changed (i.e - will not know the application name). Any thoughts? – Swetha V Mar 03 '16 at 22:39
  • The information in the post from github tells what files changed and the `/monitor` endpoint uses that to deduce the applications to send messages to. – spencergibb Mar 03 '16 at 22:54
  • @spencergibb, I am facing the exact issue. My project can be found at https://bitbucket.org/vikas_chaudhary2453/ Could you please help me. – Vikky Jun 23 '19 at 16:54
  • Adding more on my issue, I am able to get /actuator/monitor but it has security enabled for post. Webhook tries to post on actuator/monitor and gets 405 every time. – Vikky Jun 23 '19 at 23:39