SpringCloud - ConfigServer - RabbitMQ - 客户端不接收来自ConfigService的消息

时间:2017-03-20 00:24:06

标签: spring-boot spring-cloud spring-rabbit spring-cloud-config spring-cloud-bus

我正在尝试使用Gitlab存储库创建ConfigServer Remote和Client。 ConfigServer接收通过Webhooks推送的通知,但它不会将消息发送到客户端。我用Docker运行RabbitMQ,我可以在兔子的控制台中看到服务与它连接。所以我不知道是什么问题。

configServer pom文件如下所示:

<dependency>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-config-monitor</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>

ConfigServes的属性文件如下:

server.port:8888
spring.cloud.config.server.git.uri:https://gitlab.com/user/repo-properties.git

spring.cloud.config.server.git.username:user
spring.cloud.config.server.git.password:pass

spring.rabbitmq.host:172.17.0.1
spring.rabbitmq.port:5672
spring.rabbitmq.username:guest
spring.rabbitmq.password:guest

spring.cloud.bus.enabled:true

management.security.enabled:false
spring.cloud.config.server.monitor.gitlab.enabled:true

spring.profiles.active:desa

客户的pom看起来像:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<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.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

客户端的application.yml看起来像:

spring:
  rabbitmq:
    host: 172.17.0.1
    port: 5672
    username: guest
    password: guest

  application:
    name: user-server-config
  cloud:
    config:
      uri: http://localhost:8888
  profiles:
    active: desa

我用Docker运行兔子:sudo docker run --name rabbitmq -p 5672:5672 rabbitmq

我在Gitlab中创建了一个Webhooks。当推送更改时,ConfigServer会收到/ monitor的通知,但客户端没有收到更改,也没有收到任何内容。我不知道如何解决这个问题。

谢谢!

0 个答案:

没有答案