spring-cloud / spring-cloud-bus

Spring Cloud event bus
http://cloud.spring.io/spring-cloud-bus/
Apache License 2.0
408 stars 242 forks source link

Spring Cloud Config, Bus http://localhost:8888/actuator/bus-refresh not working #242

Closed cavitpinar closed 3 years ago

cavitpinar commented 3 years ago

I ve been trying to trigger bus refresh by sending post request to

http://localhost:8888/actuator/bus-refresh

The response I get >>

{ "timestamp": "2020-12-22T16:00:12.920+00:00", "status": 405, "error": "Method Not Allowed", "message": "", "path": "/actuator/bus-refresh" }

Pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.1</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.magnesiatech</groupId>
    <artifactId>MyConfigServer</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>MyConfigServer</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>11</java.version>
        <spring-cloud.version>2020.0.0-RC1</spring-cloud.version>
    </properties>

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

        <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>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
        </repository>
    </repositories>
</project>

application properties

spring.application,name=MyConfigServer
server.port=8888

#Git repo location
spring.cloud.config.server.git.uri=https://github.com/cavitpinar/CloudConfiguration
spring.cloud.config.server.git.username=cavitpinar
spring.cloud.config.server.git.password=******
spring.cloud.config.server.git.search-paths=*
spring.cloud.config.server.git.default-label=main

#Verify any repository issue in service startup
spring.cloud.config.server.git.cloneOnStart=true

management.endpoints.web.exposure.include=*

spring.rabbitmq.host=localhost
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest

Config Server console output Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported] I have changed management.endpoints.web.exposure.include to management.endpoints.web.exposure.include= bus-refresh but it did not change. RabbitMq is running and I can see the subscriber microservices in console.

I have tried many things but the problem is still there.

spencergibb commented 3 years ago

See https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2020.0-Release-Notes#breaking-changes

The new endpoint is /actuator/busrefresh

cavitpinar commented 3 years ago

/actuator/busrefresh

It took me 2 days. I check all the documentation except this one. Thank you so much.

Merry Christmas.

asheCarry commented 3 years ago

the version of my springboot is 2.2.6.RELEASE, and the version of spring-cloud-starter-bus-amqp is 2.2.2.RELEASE;.I had try many couple of them ,but still 405 while post busrefresh or bus-refresh. Can you give me some suggestions. thx

spencergibb commented 3 years ago

Not without more information from you