refactor(mq): 移除 RocketMQ 消费者和生产者示例代码
- 删除了 yudao-spring-boot-starter-mq 模块中的 Consumer 和 Product 类 - 在 yudao-server 模块中添加了 yudao-spring-boot-starter-mq 依赖 - 更新了 YudaoServerApplication 类,扫描 framework 包 - 在 pom.xml 中添加了 maven-compiler-plugin配置,支持 Java 17
This commit is contained in:
parent
120d592688
commit
7633bc5d5e
23
pom.xml
23
pom.xml
|
|
@ -15,16 +15,16 @@
|
|||
<!-- 各种 module 拓展 -->
|
||||
<module>yudao-module-system</module>
|
||||
<module>yudao-module-infra</module>
|
||||
<!-- <module>yudao-module-member</module>-->
|
||||
<!-- <module>yudao-module-bpm</module>-->
|
||||
<!-- <module>yudao-module-member</module>-->
|
||||
<!-- <module>yudao-module-bpm</module>-->
|
||||
<module>yudao-module-report</module>
|
||||
<!-- <module>yudao-module-mp</module>-->
|
||||
<!-- <module>yudao-module-mp</module>-->
|
||||
<module>yudao-module-pay</module>
|
||||
<!-- <module>yudao-module-mall</module>-->
|
||||
<!-- <module>yudao-module-crm</module>-->
|
||||
<!-- <module>yudao-module-erp</module>-->
|
||||
<!-- <module>yudao-module-mall</module>-->
|
||||
<!-- <module>yudao-module-crm</module>-->
|
||||
<!-- <module>yudao-module-erp</module>-->
|
||||
<module>yudao-module-ai</module>
|
||||
<!-- <module>yudao-module-iot</module>-->
|
||||
<!-- <module>yudao-module-iot</module>-->
|
||||
</modules>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
|
|
@ -134,6 +134,15 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
package cn.iocoder.yudao.framework.mq.rocketmq.core;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* -
|
||||
*
|
||||
* @author HuangLei
|
||||
* @since 2025-06-18
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RocketMQMessageListener(
|
||||
topic = TopicNameConstants.PAY_REFUND_ORDER,
|
||||
consumerGroup = GroupConstants.PAY_ORDER_REFUND_GROUP)
|
||||
public class Consumer implements RocketMQListener<String> {
|
||||
@Override
|
||||
public void onMessage(String message) {
|
||||
log.info("【消费】- {}", message);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
package cn.iocoder.yudao.framework.mq.rocketmq.core;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author HuangLei
|
||||
* @since 2025-06-18
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class Product {
|
||||
|
||||
|
||||
private final RocketMQTemplate rocketMQTemplate;
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
System.out.println("开始发送消息");
|
||||
rocketMQTemplate.convertAndSend("pay-refund-order", JsonUtils.toJsonString("hello world"));
|
||||
}
|
||||
}
|
||||
|
|
@ -108,6 +108,12 @@
|
|||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-mq</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- IoT 物联网相关模块。默认注释,保证编译速度 -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
||||
|
|
|
|||
|
|
@ -9,11 +9,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
* 如果你碰到启动的问题,请认真阅读 https://doc.iocoder.cn/quick-start/ 文章
|
||||
* 如果你碰到启动的问题,请认真阅读 https://doc.iocoder.cn/quick-start/ 文章
|
||||
* 如果你碰到启动的问题,请认真阅读 https://doc.iocoder.cn/quick-start/ 文章
|
||||
*
|
||||
* cn.iocoder.yudao.server
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@SuppressWarnings("SpringComponentScan") // 忽略 IDEA 无法识别 ${yudao.info.base-package}
|
||||
@SpringBootApplication(scanBasePackages = {"${yudao.info.base-package}.server", "${yudao.info.base-package}.module"})
|
||||
@SpringBootApplication(scanBasePackages = {"${yudao.info.base-package}.server", "${yudao.info.base-package}.module",
|
||||
"${yudao.info.base-package}.framework.*"})
|
||||
public class YudaoServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue