diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/Dockerfile b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/Dockerfile
deleted file mode 100644
index 489deb9863e6f7d39dd81bb48188d6d89d068fdf..0000000000000000000000000000000000000000
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/Dockerfile
+++ /dev/null
@@ -1,16 +0,0 @@
-FROM anapsix/alpine-java:8_server-jre_unlimited
-
-MAINTAINER jeecgos@163.com
-
-RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
-
-RUN mkdir -p /jeecg-cloud-example
-
-WORKDIR /jeecg-cloud-example
-
-EXPOSE 7001
-
-ADD ./target/jeecg-cloud-example-2.4.2.jar ./
-
-CMD java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-example-2.4.2.jar
-
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/pom.xml b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/pom.xml
deleted file mode 100644
index 568a7470d2a9531bb0c3518ec9aa2a5f7bae17a1..0000000000000000000000000000000000000000
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/pom.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
- jeecg-cloud-module
- org.jeecgframework.boot
- 2.4.2
-
- 4.0.0
- jeecg-cloud-example
- jeecg-cloud-example 微服务测试例子
-
-
-
- org.jeecgframework.boot
- jeecg-boot-starter-cloud
-
-
-
- org.jeecgframework.boot
- jeecg-boot-starter-job
-
-
-
-
- org.jeecgframework.boot
- jeecg-boot-starter-lock
-
-
-
-
- org.jeecgframework.boot
- jeecg-boot-starter-rabbitmq
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
- src/main/resources
- true
-
-
-
-
-
\ No newline at end of file
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/JeecgCloudExampleApplication.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/JeecgCloudExampleApplication.java
deleted file mode 100644
index 3f41e3da959032c4d3c491bc906d5fd36529a1f5..0000000000000000000000000000000000000000
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/JeecgCloudExampleApplication.java
+++ /dev/null
@@ -1,17 +0,0 @@
-
-package org.jeecg;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.openfeign.EnableFeignClients;
-import org.springframework.scheduling.annotation.EnableScheduling;
-
-@EnableScheduling
-@EnableFeignClients(basePackages = {"org.jeecg"})
-@SpringBootApplication(scanBasePackages = "org.jeecg")
-public class JeecgCloudExampleApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(JeecgCloudExampleApplication.class, args);
- }
-}
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/rabbitmq/DemoRabbitMqListener2.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/rabbitmq/DemoRabbitMqListener2.java
deleted file mode 100644
index 4ff5c07f21a862cbd9939f3ade7d65da8c205df5..0000000000000000000000000000000000000000
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/rabbitmq/DemoRabbitMqListener2.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.jeecg.cloud.demo.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.springframework.amqp.rabbit.annotation.RabbitListener;
-import org.springframework.amqp.support.AmqpHeaders;
-import org.springframework.messaging.handler.annotation.Header;
-
-@Slf4j
-@RabbitComponent(value = "testListener2")
-public class DemoRabbitMqListener2 extends BaseRabbiMqHandler {
-
- @RabbitListener(queues = "test2")
- public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
- super.onMessage(baseMap, deliveryTag, channel, new MqListener() {
- @Override
- public void handler(BaseMap map, Channel channel) {
- String orderId = map.get("orderId");
- log.info("业务处理2:orderId:" + orderId);
- }
- });
- }
-
-}
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/test/service/impl/JeecgDemoServiceImpl.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/test/service/impl/JeecgDemoServiceImpl.java
deleted file mode 100644
index a3c0e98d1ffa31f85f3f2c302f8d412f0f791df2..0000000000000000000000000000000000000000
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/test/service/impl/JeecgDemoServiceImpl.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.jeecg.cloud.demo.test.service.impl;
-
-import org.jeecg.cloud.demo.test.service.JeecgDemoService;
-import org.jeecg.common.api.vo.Result;
-import org.springframework.stereotype.Service;
-
-@Service
-public class JeecgDemoServiceImpl implements JeecgDemoService {
- @Override
- public Result getMessage(String name) {
- return Result.OK("Hello" + name);
- }
-}
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/resources/application.yml b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/resources/application.yml
deleted file mode 100644
index 8a15d58865bfc71120b1bdfc07815324043b9ae7..0000000000000000000000000000000000000000
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/resources/application.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-server:
- port: 7003
-spring:
- application:
- name: jeecg-cloud-example
\ No newline at end of file
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/pom.xml b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/pom.xml
index 6d0d38b61d35f816174be46011e2b509c1b2987a..7a3974abfdee3c9e84dbb9265efc5c9d78fd8c2f 100644
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/pom.xml
+++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/pom.xml
@@ -9,14 +9,9 @@
4.0.0
jeecg-cloud-system-start
- jeecg-cloud-system-start基础启动模块
+ System项目微服务启动
-
-
- org.jeecgframework.boot
- jeecg-boot-module-system
-
org.jeecgframework.boot
@@ -29,6 +24,12 @@
+
+
+ org.jeecgframework.boot
+ jeecg-boot-module-system
+
+
org.jeecgframework.boot
@@ -39,6 +40,12 @@
org.jeecgframework.boot
jeecg-boot-starter-job
+
+
+ org.jeecgframework.boot
+ jeecg-boot-starter-lock
+
+
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/JeecgSystemCloudApplication.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/JeecgSystemCloudApplication.java
index f40b5f9328aa5c13655237b20176f2cbbfa751f0..9aab6bb081119c739ccb17d485952b0c8f82e06a 100644
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/JeecgSystemCloudApplication.java
+++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/JeecgSystemCloudApplication.java
@@ -1,18 +1,15 @@
package org.jeecg;
import lombok.extern.slf4j.Slf4j;
-import org.apache.catalina.Context;
-import org.apache.tomcat.util.scan.StandardJarScanner;
import org.jeecg.common.util.oConvertUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
+import org.springframework.scheduling.annotation.EnableScheduling;
import java.net.InetAddress;
import java.net.UnknownHostException;
@@ -24,6 +21,7 @@ import java.net.UnknownHostException;
@Slf4j
@SpringBootApplication
@EnableFeignClients(basePackages = {"org.jeecg"})
+@EnableScheduling
public class JeecgSystemCloudApplication extends SpringBootServletInitializer {
@Override
@@ -45,4 +43,5 @@ public class JeecgSystemCloudApplication extends SpringBootServletInitializer {
"----------------------------------------------------------");
}
+
}
\ No newline at end of file
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/constant/CloudConstant.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/constant/CloudConstant.java
new file mode 100644
index 0000000000000000000000000000000000000000..cfdd2824bbb6ddf1ff7a667be6447c11e788e639
--- /dev/null
+++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/constant/CloudConstant.java
@@ -0,0 +1,30 @@
+package org.jeecg.modules.cloud.constant;
+
+/**
+ * 微服务单元测试常量定义
+ */
+public interface CloudConstant {
+
+ /**
+ * 微服务名【对应模块jeecg-boot-module-demo】
+ */
+ public final static String SERVER_NAME_JEECGDEMO = "jeecg-demo";
+
+ /**
+ * 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";
+
+}
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/bus/DemoBusEvent.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/ebus/DemoBusEvent.java
similarity index 83%
rename from jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/bus/DemoBusEvent.java
rename to jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/ebus/DemoBusEvent.java
index c4d0203c377f73f89c69d4acff252ef02f02e520..2e455426faf4e7ee5060ea16fe675e6392b675d1 100644
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/bus/DemoBusEvent.java
+++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/ebus/DemoBusEvent.java
@@ -1,17 +1,18 @@
-package org.jeecg.cloud.demo.bus;
+package org.jeecg.modules.cloud.ebus;
import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
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.cloud.constant.CloudConstant;
import org.springframework.stereotype.Component;
/**
* 消息处理器【发布订阅】
*/
@Slf4j
-@Component("demoBusEvent")
+@Component(CloudConstant.MQ_DEMO_BUS_EVENT)
public class DemoBusEvent implements JeecgBusEventHandler {
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/controller/JeecgTestFeignController.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/controller/JeecgTestFeignController.java
new file mode 100644
index 0000000000000000000000000000000000000000..1f34c9ed9f754130f61ff16f2239d1ff8a8787c4
--- /dev/null
+++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/controller/JeecgTestFeignController.java
@@ -0,0 +1,61 @@
+package org.jeecg.modules.cloud.feign.controller;
+
+
+import cn.hutool.core.util.RandomUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+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.cloud.constant.CloudConstant;
+import org.jeecg.modules.cloud.feign.feign.JeecgTestClient;
+import org.jeecg.modules.cloud.feign.feign.JeecgTestClientDyn;
+import org.jeecg.starter.cloud.feign.impl.JeecgFeignService;
+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 javax.servlet.http.HttpServletRequest;
+
+@RestController
+@RequestMapping("/sys/test")
+@Api(tags = "【微服务】单元测试")
+public class JeecgTestFeignController {
+
+ @Autowired
+ private JeecgFeignService jeecgFeignService;
+ @Autowired
+ private JeecgTestClient jeecgTestClient;
+ @Autowired
+ private RabbitMqClient rabbitMqClient;
+
+ @GetMapping("getMessage")
+ @ApiOperation(value = "测试feign", notes = "测试feign")
+ public Result getMessage() {
+ return jeecgTestClient.getMessage("jeecg-boot");
+ }
+
+ @GetMapping("getMessage2")
+ @ApiOperation(value = "测试动态feign", notes = "测试动态feign")
+ public Result getMessage2() {
+ JeecgTestClientDyn myClientDyn = jeecgFeignService.newInstance(JeecgTestClientDyn.class, CloudConstant.SERVER_NAME_JEECGDEMO);
+ return myClientDyn.getMessage("动态fegin——jeecg-boot2");
+ }
+
+ @GetMapping(value = "/rabbitmq")
+ @ApiOperation(value = "测试rabbitmq", notes = "测试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);
+
+ //rabbitmq消息总线测试
+ BaseMap params = new BaseMap();
+ params.put("orderId", "123456");
+ rabbitMqClient.publishEvent(CloudConstant.MQ_DEMO_BUS_EVENT, params);
+ return Result.OK("MQ发送消息成功");
+ }
+}
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/controller/JeecgTestFeignTest.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/controller/JeecgTestFeignTest.java
deleted file mode 100644
index cd3fc0e667fd9f716367d2d9375dd30f1e7c96f2..0000000000000000000000000000000000000000
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/controller/JeecgTestFeignTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.jeecg.modules.cloud.feign.controller;
-
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.modules.cloud.feign.feign.JeecgTestClient;
-import org.jeecg.modules.cloud.feign.feign.JeecgTestClient2;
-import org.jeecg.starter.cloud.feign.impl.JeecgFeignService;
-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;
-
-@RestController
-@RequestMapping("/sys/test")
-@Api(tags = "feign测试")
-public class JeecgTestFeignTest {
-
- @Autowired
- private JeecgFeignService jeecgFeignService;
-
- @Autowired
- private JeecgTestClient jeecgTestClient;
-
-
- @GetMapping("getMessage")
- @ApiOperation(value = "测试feign", notes = "测试feign")
- public Result getMessage() {
- return jeecgTestClient.getMessage("jeecg-boot");
- }
-
- @GetMapping("getMessage2")
- @ApiOperation(value = "测试动态feign", notes = "测试动态feign")
- public Result getMessage2() {
- JeecgTestClient2 jeecgTestClient = jeecgFeignService.newInstance(JeecgTestClient2.class, "jeecg-demo");
- return jeecgTestClient.getMessage("jeecg-boot2");
- }
-}
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/JeecgTestClient.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/JeecgTestClient.java
index 3bfa4514a57cdbd7ab6f0f8890bd20b544fae0c2..85d995c85d1aac5730a09123d4b137c671eef6a7 100644
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/JeecgTestClient.java
+++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/JeecgTestClient.java
@@ -1,6 +1,8 @@
package org.jeecg.modules.cloud.feign.feign;
import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.cloud.constant.CloudConstant;
+import org.jeecg.modules.cloud.feign.feign.fallback.JeecgTestClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
@@ -9,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestParam;
/**
* 常规feign接口定义
*/
-@FeignClient(value = "jeecg-demo", fallbackFactory = DemoFallback.class)
+@FeignClient(value = CloudConstant.SERVER_NAME_JEECGDEMO, fallbackFactory = JeecgTestClientFallback.class)
@Component
public interface JeecgTestClient {
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/JeecgTestClient2.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/JeecgTestClientDyn.java
similarity index 90%
rename from jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/JeecgTestClient2.java
rename to jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/JeecgTestClientDyn.java
index 46f1750f048e4730bb2393c245af290e6632be7f..c4f646f99d028096077b891c336ae3539a88c163 100644
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/JeecgTestClient2.java
+++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/JeecgTestClientDyn.java
@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.RequestParam;
/**
* 动态feign接口定义
*/
-public interface JeecgTestClient2 {
+public interface JeecgTestClientDyn {
@GetMapping(value = "/test/getMessage")
Result getMessage(@RequestParam("name") String name);
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/DemoFallback.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/fallback/JeecgTestClientFallback.java
similarity index 53%
rename from jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/DemoFallback.java
rename to jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/fallback/JeecgTestClientFallback.java
index a23c72ab7ae69db5dae3a0d870ad059aaaa8509e..cc22023513362165e1da9b116b922540b16cccfa 100644
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/DemoFallback.java
+++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/feign/fallback/JeecgTestClientFallback.java
@@ -1,13 +1,14 @@
-package org.jeecg.modules.cloud.feign.feign;
+package org.jeecg.modules.cloud.feign.feign.fallback;
import feign.hystrix.FallbackFactory;
+import org.jeecg.modules.cloud.feign.feign.JeecgTestClient;
import org.springframework.stereotype.Component;
/**
* @author qinfeng
*/
@Component
-public class DemoFallback implements FallbackFactory {
+public class JeecgTestClientFallback implements FallbackFactory {
@Override
public JeecgTestClient create(Throwable throwable) {
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/lock/DemoLockTest.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/lock/DemoLockTest.java
similarity index 57%
rename from jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/lock/DemoLockTest.java
rename to jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/lock/DemoLockTest.java
index a22fa1482ed427b532b778c9bc6fe09db2f5e8ca..1b6e08f0459c89b2f3a1d8ff77ddded6807c41f3 100644
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/lock/DemoLockTest.java
+++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/lock/DemoLockTest.java
@@ -1,9 +1,11 @@
-package org.jeecg.cloud.demo.lock;
+package org.jeecg.modules.cloud.lock;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.boot.starter.lock.annotation.DistributedLock;
import org.jeecg.boot.starter.lock.client.RedissonLockClient;
import org.jeecg.boot.starter.rabbitmq.client.RabbitMqClient;
+import org.jeecg.common.base.BaseMap;
+import org.jeecg.modules.cloud.constant.CloudConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -19,43 +21,45 @@ import java.util.Map;
public class DemoLockTest {
@Autowired
RedissonLockClient redissonLock;
-
@Autowired
RabbitMqClient rabbitMqClient;
/**
- * 注解方式测试分布式锁
+ * 测试分布式锁【注解方式】
*/
- //@Scheduled(cron = "0/5 * * * * ?")
- @DistributedLock(lockKey = "redis-lock", expireSeconds = 11)
+ @Scheduled(cron = "0/5 * * * * ?")
+ @DistributedLock(lockKey = CloudConstant.REDISSON_DEMO_LOCK_KEY1)
public void execute() throws InterruptedException {
log.info("执行execute任务开始,休眠三秒");
Thread.sleep(3000);
System.out.println("=======================业务逻辑1=============================");
- Map map = new HashMap();
- map.put("orderId", "12345");
- rabbitMqClient.sendMessage("test", map);
+ Map map = new BaseMap();
+ map.put("orderId", "BJ0001");
+ rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map);
//延迟10秒发送
- map.put("orderId", "555555");
- rabbitMqClient.sendMessage("test", map, 10000);
+ map.put("orderId", "NJ0002");
+ rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map, 10000);
log.info("execute任务结束,休眠三秒");
}
+ public DemoLockTest() {
+ }
+
/**
- * 编码方式测试分布式锁
+ * 测试分布式锁【编码方式】
*/
- //@Scheduled(cron = "0/10 * * * * ?")
+ //@Scheduled(cron = "0/5 * * * * ?")
public void execute2() throws InterruptedException {
- if (redissonLock.tryLock("redisson", -1, 10)) {
- log.info("执行任务execute2开始,休眠三秒");
- Thread.sleep(3000);
+ if (redissonLock.tryLock(CloudConstant.REDISSON_DEMO_LOCK_KEY2, -1, 6000)) {
+ log.info("执行任务execute2开始,休眠十秒");
+ Thread.sleep(10000);
System.out.println("=======================业务逻辑2=============================");
- log.info("定时execute2结束,休眠三秒");
- redissonLock.unlock("redisson");
+ log.info("定时execute2结束,休眠十秒");
+
+ redissonLock.unlock(CloudConstant.REDISSON_DEMO_LOCK_KEY2);
} else {
log.info("execute2获取锁失败");
}
}
-
}
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloReceiver1.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloReceiver1.java
index 1bd18122dab67968b451bc61b9a99cc91116543d..29de6ef4099789a9761b8ee1a1a69498524b2855 100644
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloReceiver1.java
+++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloReceiver1.java
@@ -1,16 +1,23 @@
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.cloud.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;
-@RabbitListener(queues = "jeecg_place_order")
+/**
+ * RabbitMq接受者1
+ * (@RabbitListener声明类上,一个类只能监听一个队列)
+ */
+@Slf4j
+@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER)
@RabbitComponent(value = "helloReceiver1")
public class HelloReceiver1 extends BaseRabbiMqHandler {
@@ -21,7 +28,7 @@ public class HelloReceiver1 extends BaseRabbiMqHandler {
public void handler(BaseMap map, Channel channel) {
//业务处理
String orderId = map.get("orderId").toString();
- System.out.println("Receiver1 : " + orderId);
+ log.info("MQ Receiver1,orderId : " + orderId);
}
});
}
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloReceiver2.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloReceiver2.java
index eba796a7f901e9e0f8df797a3b18a99b9e6af819..abc83910b85c51e1dab7cf13fca0adec0f777d81 100644
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloReceiver2.java
+++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloReceiver2.java
@@ -1,16 +1,23 @@
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.cloud.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;
-@RabbitListener(queues = "jeecg_place_order")
+/**
+ * RabbitMq接受者2
+ * (@RabbitListener声明类上,一个类只能监听一个队列)
+ */
+@Slf4j
+@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER)
@RabbitComponent(value = "helloReceiver2")
public class HelloReceiver2 extends BaseRabbiMqHandler {
@@ -21,7 +28,7 @@ public class HelloReceiver2 extends BaseRabbiMqHandler {
public void handler(BaseMap map, Channel channel) {
//业务处理
String orderId = map.get("orderId").toString();
- System.out.println("Receiver2 : " + orderId);
+ log.info("MQ Receiver2,orderId : " + orderId);
}
});
}
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/rabbitmq/DemoRabbitMqListener3.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloReceiver3.java
similarity index 65%
rename from jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/rabbitmq/DemoRabbitMqListener3.java
rename to jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloReceiver3.java
index 75c48681735fca5b54b1a14463b6a72586133a7e..5289c3aa4433dbcbe2a3fff33dd1fa09e2fee6ac 100644
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/rabbitmq/DemoRabbitMqListener3.java
+++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloReceiver3.java
@@ -1,4 +1,4 @@
-package org.jeecg.cloud.demo.rabbitmq;
+package org.jeecg.modules.cloud.rabbitmq;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
@@ -6,24 +6,30 @@ 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.cloud.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;
+/**
+ * RabbitMq接受者3
+ * (@RabbitListener声明类方法上,一个类可以多监听多个队列)
+ */
@Slf4j
-@RabbitListener(queues = "test3")
-@RabbitComponent(value = "testListener3")
-public class DemoRabbitMqListener3 extends BaseRabbiMqHandler {
+@RabbitComponent(value = "helloReceiver3")
+public class HelloReceiver3 extends BaseRabbiMqHandler {
- @RabbitHandler
+ @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() {
@Override
public void handler(BaseMap map, Channel channel) {
+ //业务处理
String orderId = map.get("orderId").toString();
- log.info("业务处理3:orderId:" + orderId);
+ log.info("MQ Receiver3,orderId : " + orderId);
}
});
}
-}
+
+}
\ No newline at end of file
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloTimeReceiver.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloTimeReceiver.java
index 97fa05d78b6dfdbd245f61dcf3afb6ad1d34f5c6..649c9cc373b5e507250921c78f673ad088f4d8fd 100644
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloTimeReceiver.java
+++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloTimeReceiver.java
@@ -1,16 +1,19 @@
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.cloud.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;
-@RabbitListener(queues = "jeecg_place_order_time")
+@Slf4j
+@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER_TIME)
@RabbitComponent(value = "helloTimeReceiver")
public class HelloTimeReceiver extends BaseRabbiMqHandler {
@@ -21,7 +24,7 @@ public class HelloTimeReceiver extends BaseRabbiMqHandler {
public void handler(BaseMap map, Channel channel) {
//业务处理
String orderId = map.get("orderId").toString();
- System.out.println("Receiver1 : " + orderId);
+ log.info("Time Receiver1,orderId : " + orderId);
}
});
}
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/xxljob/Demo2JobHandler.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/xxljob/Demo2JobHandler.java
deleted file mode 100644
index ef06a9d9480f5c5a98475f7f8d7a56244a59af1f..0000000000000000000000000000000000000000
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/xxljob/Demo2JobHandler.java
+++ /dev/null
@@ -1,57 +0,0 @@
-
-package org.jeecg.modules.cloud.xxljob;;
-
-
-import com.xxl.job.core.biz.model.ReturnT;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import com.xxl.job.core.log.XxlJobLogger;
-import com.xxl.job.core.util.ShardingUtil;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Component;
-
-
-/**
- * xxl-job定时任务测试
- */
-@Component
-@Slf4j
-public class Demo2JobHandler {
-
-
- /**
- * 简单任务
- *
- * @param params
- * @return
- */
-
- @XxlJob(value = "demoJob2")
- public ReturnT demoJobHandler(String params) {
- log.info("我是定时任务,我执行了...............................");
- return ReturnT.SUCCESS;
- }
-
- /**
- * 2、分片广播任务
- */
-
- @XxlJob("shardingJobHandler3")
- public ReturnT shardingJobHandler(String param) throws Exception {
-
- // 分片参数
- ShardingUtil.ShardingVO shardingVO = ShardingUtil.getShardingVo();
- XxlJobLogger.log("分片参数:当前分片序号 = {}, 总分片数 = {}", shardingVO.getIndex(), shardingVO.getTotal());
-
- // 业务逻辑
- for (int i = 0; i < shardingVO.getTotal(); i++) {
- if (i == shardingVO.getIndex()) {
- XxlJobLogger.log("第 {} 片, 命中分片开始处理", i);
- } else {
- XxlJobLogger.log("第 {} 片, 忽略", i);
- }
- }
-
- return ReturnT.SUCCESS;
- }
-}
-
diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/job/DemoJobHandler.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/xxljob/DemoJobHandler.java
similarity index 99%
rename from jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/job/DemoJobHandler.java
rename to jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/xxljob/DemoJobHandler.java
index 009904074f8c0e7416fedf03d86b6ba9adfcdbeb..528dd52db517d0084a0cad6f3cc87fbf788a1c6c 100644
--- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-example/src/main/java/org/jeecg/cloud/demo/job/DemoJobHandler.java
+++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/xxljob/DemoJobHandler.java
@@ -1,5 +1,5 @@
-package org.jeecg.cloud.demo.job;
+package org.jeecg.modules.cloud.xxljob;;
import com.xxl.job.core.biz.model.ReturnT;
@@ -230,5 +230,6 @@ public class DemoJobHandler {
public void destroy() {
log.info("destory");
}
+
}