去除cloud-test模块、rabbitmq模块
This commit is contained in:
parent
da4cbacb56
commit
7ccfbe9c18
|
@ -14,6 +14,7 @@
|
|||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-system-local-api</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
|
|
|
@ -29,11 +29,6 @@
|
|||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-starter3-job</artifactId>
|
||||
</dependency>
|
||||
<!--rabbitmq消息队列-->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-starter3-rabbitmq</artifactId>
|
||||
</dependency>
|
||||
<!-- 分布式锁依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-test</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.8.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<description>消息队列测试模块</description>
|
||||
<artifactId>jeecg-cloud-test-rabbitmq</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!--rabbitmq消息队列-->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-starter3-rabbitmq</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -1,28 +0,0 @@
|
|||
package org.jeecg.modules.test.rabbitmq.constant;
|
||||
|
||||
/**
|
||||
* 微服务单元测试常量定义
|
||||
* @author: zyf
|
||||
* @date: 2022/04/21
|
||||
*/
|
||||
public interface CloudConstant {
|
||||
|
||||
|
||||
/**
|
||||
* MQ测试队列名字
|
||||
*/
|
||||
public final static String MQ_JEECG_PLACE_ORDER = "jeecg_place_order";
|
||||
public final static String MQ_JEECG_PLACE_ORDER_TIME = "jeecg_place_order_time";
|
||||
|
||||
/**
|
||||
* MQ测试消息总线
|
||||
*/
|
||||
public final static String MQ_DEMO_BUS_EVENT = "demoBusEvent";
|
||||
|
||||
/**
|
||||
* 分布式锁lock key
|
||||
*/
|
||||
public final static String REDISSON_DEMO_LOCK_KEY1 = "demoLockKey1";
|
||||
public final static String REDISSON_DEMO_LOCK_KEY2 = "demoLockKey2";
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package org.jeecg.modules.test.rabbitmq.controller;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.jeecg.boot.starter.rabbitmq.client.RabbitMqClient;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.base.BaseMap;
|
||||
import org.jeecg.modules.test.rabbitmq.constant.CloudConstant;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
|
||||
|
||||
/**
|
||||
* RabbitMqClient发送消息
|
||||
* @author: zyf
|
||||
* @date: 2022/04/21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/test")
|
||||
@Tag(name = "【微服务】MQ单元测试")
|
||||
public class JeecgMqTestController {
|
||||
|
||||
@Autowired
|
||||
private RabbitMqClient rabbitMqClient;
|
||||
|
||||
|
||||
/**
|
||||
* 测试方法:快速点击发送MQ消息
|
||||
* 观察三个接受者如何分配处理消息:HelloReceiver1、HelloReceiver2、HelloReceiver3,会均衡分配
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/rabbitmq")
|
||||
@Operation(summary = "测试rabbitmq")
|
||||
public Result<?> rabbitMqClientTest(HttpServletRequest req) {
|
||||
//rabbitmq消息队列测试
|
||||
BaseMap map = new BaseMap();
|
||||
map.put("orderId", RandomUtil.randomNumbers(10));
|
||||
rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map);
|
||||
rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER_TIME, map,10);
|
||||
return Result.OK("MQ发送消息成功");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/rabbitmq2")
|
||||
@Operation(summary = "rabbitmq消息总线测试")
|
||||
public Result<?> rabbitmq2(HttpServletRequest req) {
|
||||
|
||||
//rabbitmq消息总线测试
|
||||
BaseMap params = new BaseMap();
|
||||
params.put("orderId", "123456");
|
||||
rabbitMqClient.publishEvent(CloudConstant.MQ_DEMO_BUS_EVENT, params);
|
||||
return Result.OK("MQ发送消息成功");
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package org.jeecg.modules.test.rabbitmq.event;
|
||||
|
||||
import org.jeecg.boot.starter.rabbitmq.event.EventObj;
|
||||
import org.jeecg.boot.starter.rabbitmq.event.JeecgBusEventHandler;
|
||||
import org.jeecg.common.base.BaseMap;
|
||||
import org.jeecg.modules.test.rabbitmq.constant.CloudConstant;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 消息处理器【发布订阅】
|
||||
* @author: zyf
|
||||
* @date: 2022/04/21
|
||||
*/
|
||||
@Slf4j
|
||||
@Component(CloudConstant.MQ_DEMO_BUS_EVENT)
|
||||
public class DemoBusEvent implements JeecgBusEventHandler {
|
||||
|
||||
|
||||
@Override
|
||||
public void onMessage(EventObj obj) {
|
||||
if (ObjectUtil.isNotEmpty(obj)) {
|
||||
BaseMap baseMap = obj.getBaseMap();
|
||||
String orderId = baseMap.get("orderId");
|
||||
log.info("业务处理----订单ID:" + orderId);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package org.jeecg.modules.test.rabbitmq.listener;
|
||||
|
||||
import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
|
||||
import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
|
||||
import org.jeecg.common.annotation.RabbitComponent;
|
||||
import org.jeecg.common.base.BaseMap;
|
||||
import org.jeecg.modules.test.rabbitmq.constant.CloudConstant;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.support.AmqpHeaders;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.handler.annotation.Header;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 定义接收者(可以定义N个接受者,消息会均匀的发送到N个接收者中)
|
||||
*
|
||||
* RabbitMq接受者1
|
||||
* (@RabbitListener声明类上,一个类只能监听一个队列)
|
||||
* @author: zyf
|
||||
* @date: 2022/04/21
|
||||
*/
|
||||
@Slf4j
|
||||
@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER)
|
||||
@RabbitComponent(value = "helloReceiver1")
|
||||
public class HelloReceiver1 extends BaseRabbiMqHandler<BaseMap> {
|
||||
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@RabbitHandler
|
||||
public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
||||
super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() {
|
||||
@Override
|
||||
public void handler(BaseMap map, Channel channel) {
|
||||
//业务处理
|
||||
String orderId = map.get("orderId").toString();
|
||||
log.info("【我是处理人1】 MQ Receiver1,orderId : " + orderId);
|
||||
// jeecgTestClient.getMessage("JEECG");
|
||||
try{
|
||||
// HttpHeaders requestHeaders = new HttpHeaders();
|
||||
// requestHeaders.add("X-Access-Token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MzExOTcyOTEsInVzZXJuYW1lIjoiYWRtaW4ifQ.N8mJvwzb4G0i3vYF9A2Bmf5cDKb1LDnOp1RwtpYEu1E");
|
||||
// requestHeaders.add("content-type", MediaType.APPLICATION_JSON_UTF8.toString());
|
||||
// MultiValueMap<String, String> requestBody = new LinkedMultiValueMap<>();
|
||||
// requestBody.add("name", "test");
|
||||
// HttpEntity< MultiValueMap<String, String> > requestEntity = new HttpEntity(requestBody, requestHeaders);
|
||||
// //post
|
||||
// ResponseEntity<String> responseEntity = restTemplate.postForEntity("http://localhost:7002/test/getMessage", requestEntity, String.class);
|
||||
// System.out.println(" responseEntity :"+responseEntity.getBody());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package org.jeecg.modules.test.rabbitmq.listener;//package org.jeecg.modules.cloud.rabbitmq;
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
|
||||
import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
|
||||
import org.jeecg.common.annotation.RabbitComponent;
|
||||
import org.jeecg.common.base.BaseMap;
|
||||
import org.jeecg.modules.test.rabbitmq.constant.CloudConstant;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.support.AmqpHeaders;
|
||||
import org.springframework.messaging.handler.annotation.Header;
|
||||
|
||||
/**
|
||||
* 定义接收者(可以定义N个接受者,消息会均匀的发送到N个接收者中)
|
||||
*
|
||||
* RabbitMq接受者2
|
||||
* (@RabbitListener声明类上,一个类只能监听一个队列)
|
||||
* @author: zyf
|
||||
* @date: 2022/04/21
|
||||
*/
|
||||
@Slf4j
|
||||
@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER)
|
||||
@RabbitComponent(value = "helloReceiver2")
|
||||
public class HelloReceiver2 extends BaseRabbiMqHandler<BaseMap> {
|
||||
|
||||
@RabbitHandler
|
||||
public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
||||
super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() {
|
||||
@Override
|
||||
public void handler(BaseMap map, Channel channel) {
|
||||
//业务处理
|
||||
String orderId = map.get("orderId").toString();
|
||||
log.info("【我是处理人2】 MQ Receiver2,orderId : " + orderId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package org.jeecg.modules.test.rabbitmq.listener;//package org.jeecg.modules.cloud.rabbitmq;
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
|
||||
import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
|
||||
import org.jeecg.common.annotation.RabbitComponent;
|
||||
import org.jeecg.common.base.BaseMap;
|
||||
import org.jeecg.modules.test.rabbitmq.constant.CloudConstant;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.support.AmqpHeaders;
|
||||
import org.springframework.messaging.handler.annotation.Header;
|
||||
|
||||
/**
|
||||
* 定义接收者(可以定义N个接受者,消息会均匀的发送到N个接收者中)
|
||||
*
|
||||
* RabbitMq接受者3【我是处理人3】
|
||||
* (@RabbitListener声明类方法上,一个类可以多监听多个队列)
|
||||
* @author: zyf
|
||||
* @date: 2022/04/21
|
||||
*/
|
||||
@Slf4j
|
||||
@RabbitComponent(value = "helloReceiver3")
|
||||
public class HelloReceiver3 extends BaseRabbiMqHandler<BaseMap> {
|
||||
|
||||
@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER)
|
||||
public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
||||
super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() {
|
||||
@Override
|
||||
public void handler(BaseMap map, Channel channel) {
|
||||
//业务处理
|
||||
String orderId = map.get("orderId").toString();
|
||||
log.info("【我是处理人3】MQ Receiver3,orderId : " + orderId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package org.jeecg.modules.test.rabbitmq.listener;
|
||||
|
||||
import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
|
||||
import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
|
||||
import org.jeecg.common.annotation.RabbitComponent;
|
||||
import org.jeecg.common.base.BaseMap;
|
||||
import org.jeecg.modules.test.rabbitmq.constant.CloudConstant;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.support.AmqpHeaders;
|
||||
import org.springframework.messaging.handler.annotation.Header;
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 定义接收者(可以定义N个接受者,消息会均匀的发送到N个接收者中)
|
||||
* @author: zyf
|
||||
* @date: 2022/04/21
|
||||
*/
|
||||
@Slf4j
|
||||
@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER_TIME)
|
||||
@RabbitComponent(value = "helloTimeReceiver")
|
||||
public class HelloTimeReceiver extends BaseRabbiMqHandler<BaseMap> {
|
||||
|
||||
@RabbitHandler
|
||||
public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
||||
super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() {
|
||||
@Override
|
||||
public void handler(BaseMap map, Channel channel) {
|
||||
//业务处理
|
||||
String orderId = map.get("orderId").toString();
|
||||
log.info("Time Receiver1,orderId : " + orderId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -22,7 +22,6 @@
|
|||
<modules>
|
||||
<module>jeecg-cloud-test-shardingsphere</module>
|
||||
<module>jeecg-cloud-test-more</module>
|
||||
<module>jeecg-cloud-test-rabbitmq</module>
|
||||
<module>jeecg-cloud-test-seata</module>
|
||||
<module>jeecg-cloud-test-rocketmq</module>
|
||||
</modules>
|
||||
|
|
21
pom.xml
21
pom.xml
|
@ -53,6 +53,9 @@
|
|||
<!-- 国产数据库驱动 -->
|
||||
<kingbase8.version>9.0.0</kingbase8.version>
|
||||
<dm8.version>8.1.1.49</dm8.version>
|
||||
|
||||
<!-- 积木报表-->
|
||||
<jimureport-spring-boot-starter.version>2.0.0</jimureport-spring-boot-starter.version>
|
||||
<minidao.version>1.10.11</minidao.version>
|
||||
<!-- 持久层 -->
|
||||
<mybatis-plus.version>3.5.12</mybatis-plus.version>
|
||||
|
@ -182,12 +185,6 @@
|
|||
<artifactId>jeecg-boot-base-core</artifactId>
|
||||
<version>${jeecgboot.version}</version>
|
||||
</dependency>
|
||||
<!-- system 单体 api -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-system-local-api</artifactId>
|
||||
<version>${jeecgboot.version}</version>
|
||||
</dependency>
|
||||
<!-- system 微服务 api -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
|
@ -213,12 +210,6 @@
|
|||
<artifactId>jeecg-boot-starter3-lock</artifactId>
|
||||
<version>${jeecgboot.version}</version>
|
||||
</dependency>
|
||||
<!--rabbitmq消息队列-->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-starter3-rabbitmq</artifactId>
|
||||
<version>${jeecgboot.version}</version>
|
||||
</dependency>
|
||||
<!--rocketmq-->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
|
@ -436,6 +427,12 @@
|
|||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- 积木BI大屏和仪表盘 -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.jimureport</groupId>
|
||||
<artifactId>jimubi-spring-boot3-starter</artifactId>
|
||||
<version>1.9.5</version>
|
||||
</dependency>
|
||||
<!-- chatgpt -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
|
|
Loading…
Reference in New Issue
Block a user