mirror of
https://gitee.com/yudaocode/SpringBoot-Labs.git
synced 2026-09-03 13:57:29 +08:00
增加 spring cloud bus kafka 示例
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>labx-19-sc-bus-rabbitmq-demo-listener-actuator</artifactId>
|
||||
<artifactId>labx-19-sc-bus-kafka-demo-listener-actuator</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
@@ -48,10 +48,10 @@
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 引入基于 RabbitMQ 的 Spring Cloud Bus 的实现的依赖,并实现对其的自动配置 -->
|
||||
<!-- 引入基于 Kafka 的 Spring Cloud Bus 的实现的依赖,并实现对其的自动配置 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
|
||||
<artifactId>spring-cloud-starter-bus-kafka</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 实现对 Actuator 的自动化配置 -->
|
||||
@@ -2,12 +2,9 @@ spring:
|
||||
application:
|
||||
name: listener-demo
|
||||
|
||||
# RabbitMQ 相关配置项
|
||||
rabbitmq:
|
||||
host: localhost
|
||||
port: 5672
|
||||
username: guest
|
||||
password: guest
|
||||
# Kafka 配置项,对应 KafkaProperties 配置类
|
||||
kafka:
|
||||
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
||||
|
||||
server:
|
||||
port: 18080 # 随机端口,方便启动多个消费者
|
||||
@@ -9,7 +9,7 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>labx-19-sc-bus-rabbitmq-demo-publisher-actuator</artifactId>
|
||||
<artifactId>labx-19-sc-bus-kafka-demo-publisher-actuator</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
@@ -48,10 +48,10 @@
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 引入基于 RabbitMQ 的 Spring Cloud Bus 的实现的依赖,并实现对其的自动配置 -->
|
||||
<!-- 引入基于 Kafka 的 Spring Cloud Bus 的实现的依赖,并实现对其的自动配置 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
|
||||
<artifactId>spring-cloud-starter-bus-kafka</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 实现对 Actuator 的自动化配置 -->
|
||||
@@ -2,12 +2,9 @@ spring:
|
||||
application:
|
||||
name: publisher-demo
|
||||
|
||||
# RabbitMQ 相关配置项
|
||||
rabbitmq:
|
||||
host: localhost
|
||||
port: 5672
|
||||
username: guest
|
||||
password: guest
|
||||
# Kafka 配置项,对应 KafkaProperties 配置类
|
||||
kafka:
|
||||
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
@@ -33,5 +33,4 @@ public class DemoController {
|
||||
return "success";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
<module>labx-19-sc-bus-kafka-demo-publisher</module>
|
||||
<module>labx-19-sc-bus-kafka-demo-listener</module>
|
||||
|
||||
<!-- <module>labx-19-sc-bus-rabbitmq-demo-listener-actuator</module>-->
|
||||
<!-- <module>labx-19-sc-bus-rabbitmq-demo-publisher-actuator</module>-->
|
||||
<module>labx-19-sc-bus-kafka-demo-listener-actuator</module>
|
||||
<module>labx-19-sc-bus-kafka-demo-publisher-actuator</module>
|
||||
</modules>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user