J_D
J_D

Reputation: 3586

Spring Config Server does not seem to notify Bus

I am using Spring 2.0.1.RELEASE and have setup all projects (2 services and the cloud config server) with spring-cloud-bus

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-bus-amqp</artifactId>
    </dependency>

The config server also has the spring-cloud-config-monitor

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

I edit a file in my Git reposiroty (using local files with native profile of Spring Cloud Config). The change is detected, and I see the following line in the Cloud Config Server:

17:59:25.201 [task-scheduler-3] INFO  o.s.cloud.bus.event.RefreshListener - Received remote refresh request. Keys refreshed [version.client.min]

However, none of the other services receive the notification about updated keys.

On the other hand, if I manually call the bus-refresh endpoint of any other service, I see that all modules receive the updated key. The config server itself also receives the notification, but it says that there is no key updated, which makes sense since it already detected the change.

The documentation did not mention any special property to set apart from the RabbitMQ properties (which seem to be well configured since the bus-refresh endpoint is working as expected.)

I saw that there are already a few posts about this, one is even pointing to a bug that has been marked as resolved (https://github.com/spring-cloud/spring-cloud-bus/issues/101) but it does not seem to be working on my side.

Any property to enable for the config server to notify the bus? Any hint regarding how to debug this?

Upvotes: 1

Views: 1325

Answers (2)

Esther
Esther

Reputation: 325

Perhaps your bootstrap.properties file aren't getting loaded on project startup

So a few things firsthand: If you're using, (in your Cloud Config project),

<spring-cloud.version> 2020.0.0 (to be found under <DependencyManagement> or either specified in <properties>)

Then Spring Boot versions lower then 2.4.1 (in the same project) will not start up the cloud config server under its default dependencies.

So if you áre using the above versions, and maybe versions above,

Then for the projects that need updating by cloud Bus (using bootstrap.properties for instance) should contain the Starter Bootstrap dependency (of course along with the cloud-starter-config and the bus-amqp dependency)

<!--    Spring Cloud Config + Cloud Bus + Bootstrap-->

        <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>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bootstrap</artifactId>
        </dependency>

Plus check that the Spring cloud version is 2020.0.0-M6 or Hoxton.BUILD-SNAPSHOT depending on which Spring Boot version you're using. Here's a screenshot of which Spring Cloud versions are compatible with which Spring Boot versions

v v v v v v v

enter image description here

Upvotes: 0

J_D
J_D

Reputation: 3586

Easy fix (after a lots of research!) Changed all dependencies of org.springframework.cloud from FINCHLEY.M9 to 2.0.0.RC1 and suddenly, everything started working!

Upvotes: 1

Related Questions