Commit 03d742d9afcc7cd3777bc0893b691225c5187eac
1 parent
2a7a5fd4
默认注释掉微服务的mq测试示例代码,减少入门难度
Showing
8 changed files
with
205 additions
and
216 deletions
jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/pom.xml
... | ... | @@ -30,11 +30,11 @@ |
30 | 30 | <artifactId>jeecg-boot-module-system</artifactId> |
31 | 31 | </dependency> |
32 | 32 | |
33 | - <!--rabbitmq消息队列--> | |
33 | + <!--rabbitmq消息队列 | |
34 | 34 | <dependency> |
35 | 35 | <groupId>org.jeecgframework.boot</groupId> |
36 | 36 | <artifactId>jeecg-boot-starter-rabbitmq</artifactId> |
37 | - </dependency> | |
37 | + </dependency>--> | |
38 | 38 | <!--xxl-job定时任务--> |
39 | 39 | <dependency> |
40 | 40 | <groupId>org.jeecgframework.boot</groupId> |
... | ... |
jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/ebus/DemoBusEvent.java
1 | -package org.jeecg.modules.cloud.ebus; | |
2 | - | |
3 | -import cn.hutool.core.util.ObjectUtil; | |
4 | -import lombok.extern.slf4j.Slf4j; | |
5 | -import org.jeecg.boot.starter.rabbitmq.event.EventObj; | |
6 | -import org.jeecg.boot.starter.rabbitmq.event.JeecgBusEventHandler; | |
7 | -import org.jeecg.common.base.BaseMap; | |
8 | -import org.jeecg.modules.cloud.constant.CloudConstant; | |
9 | -import org.springframework.stereotype.Component; | |
10 | - | |
11 | -/** | |
12 | - * 消息处理器【发布订阅】 | |
13 | - */ | |
14 | -@Slf4j | |
15 | -@Component(CloudConstant.MQ_DEMO_BUS_EVENT) | |
16 | -public class DemoBusEvent implements JeecgBusEventHandler { | |
17 | - | |
18 | - | |
19 | - @Override | |
20 | - public void onMessage(EventObj obj) { | |
21 | - if (ObjectUtil.isNotEmpty(obj)) { | |
22 | - BaseMap baseMap = obj.getBaseMap(); | |
23 | - String orderId = baseMap.get("orderId"); | |
24 | - log.info("业务处理----订单ID:" + orderId); | |
25 | - } | |
26 | - } | |
27 | -} | |
1 | +//package org.jeecg.modules.cloud.ebus; | |
2 | +// | |
3 | +//import cn.hutool.core.util.ObjectUtil; | |
4 | +//import lombok.extern.slf4j.Slf4j; | |
5 | +//import org.jeecg.boot.starter.rabbitmq.event.EventObj; | |
6 | +//import org.jeecg.boot.starter.rabbitmq.event.JeecgBusEventHandler; | |
7 | +//import org.jeecg.common.base.BaseMap; | |
8 | +//import org.jeecg.modules.cloud.constant.CloudConstant; | |
9 | +//import org.springframework.stereotype.Component; | |
10 | +// | |
11 | +///** | |
12 | +// * 消息处理器【发布订阅】 | |
13 | +// */ | |
14 | +//@Slf4j | |
15 | +//@Component(CloudConstant.MQ_DEMO_BUS_EVENT) | |
16 | +//public class DemoBusEvent implements JeecgBusEventHandler { | |
17 | +// | |
18 | +// | |
19 | +// @Override | |
20 | +// public void onMessage(EventObj obj) { | |
21 | +// if (ObjectUtil.isNotEmpty(obj)) { | |
22 | +// BaseMap baseMap = obj.getBaseMap(); | |
23 | +// String orderId = baseMap.get("orderId"); | |
24 | +// log.info("业务处理----订单ID:" + orderId); | |
25 | +// } | |
26 | +// } | |
27 | +//} | |
... | ... |
jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/feign/controller/JeecgTestFeignController.java
1 | 1 | package org.jeecg.modules.cloud.feign.controller; |
2 | 2 | |
3 | 3 | |
4 | -import cn.hutool.core.util.RandomUtil; | |
5 | 4 | import io.swagger.annotations.Api; |
6 | 5 | import io.swagger.annotations.ApiOperation; |
7 | -import org.jeecg.boot.starter.rabbitmq.client.RabbitMqClient; | |
8 | 6 | import org.jeecg.common.api.vo.Result; |
9 | -import org.jeecg.common.base.BaseMap; | |
10 | 7 | import org.jeecg.modules.cloud.constant.CloudConstant; |
11 | 8 | import org.jeecg.modules.cloud.feign.feign.JeecgTestClient; |
12 | 9 | import org.jeecg.modules.cloud.feign.feign.JeecgTestClientDyn; |
... | ... | @@ -16,8 +13,6 @@ import org.springframework.web.bind.annotation.GetMapping; |
16 | 13 | import org.springframework.web.bind.annotation.RequestMapping; |
17 | 14 | import org.springframework.web.bind.annotation.RestController; |
18 | 15 | |
19 | -import javax.servlet.http.HttpServletRequest; | |
20 | - | |
21 | 16 | @RestController |
22 | 17 | @RequestMapping("/sys/test") |
23 | 18 | @Api(tags = "【微服务】单元测试") |
... | ... | @@ -27,8 +22,8 @@ public class JeecgTestFeignController { |
27 | 22 | private JeecgFeignService jeecgFeignService; |
28 | 23 | @Autowired |
29 | 24 | private JeecgTestClient jeecgTestClient; |
30 | - @Autowired | |
31 | - private RabbitMqClient rabbitMqClient; | |
25 | +// @Autowired | |
26 | +// private RabbitMqClient rabbitMqClient; | |
32 | 27 | |
33 | 28 | @GetMapping("getMessage") |
34 | 29 | @ApiOperation(value = "测试feign", notes = "测试feign") |
... | ... | @@ -43,19 +38,19 @@ public class JeecgTestFeignController { |
43 | 38 | return myClientDyn.getMessage("动态fegin——jeecg-boot2"); |
44 | 39 | } |
45 | 40 | |
46 | - @GetMapping(value = "/rabbitmq") | |
47 | - @ApiOperation(value = "测试rabbitmq", notes = "测试rabbitmq") | |
48 | - public Result<?> rabbitMqClientTest(HttpServletRequest req) { | |
49 | - //rabbitmq消息队列测试 | |
50 | - BaseMap map = new BaseMap(); | |
51 | - map.put("orderId", RandomUtil.randomNumbers(10)); | |
52 | - rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map); | |
53 | - rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER_TIME, map,10); | |
54 | - | |
55 | - //rabbitmq消息总线测试 | |
56 | - BaseMap params = new BaseMap(); | |
57 | - params.put("orderId", "123456"); | |
58 | - rabbitMqClient.publishEvent(CloudConstant.MQ_DEMO_BUS_EVENT, params); | |
59 | - return Result.OK("MQ发送消息成功"); | |
60 | - } | |
41 | +// @GetMapping(value = "/rabbitmq") | |
42 | +// @ApiOperation(value = "测试rabbitmq", notes = "测试rabbitmq") | |
43 | +// public Result<?> rabbitMqClientTest(HttpServletRequest req) { | |
44 | +// //rabbitmq消息队列测试 | |
45 | +// BaseMap map = new BaseMap(); | |
46 | +// map.put("orderId", RandomUtil.randomNumbers(10)); | |
47 | +// rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map); | |
48 | +// rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER_TIME, map,10); | |
49 | +// | |
50 | +// //rabbitmq消息总线测试 | |
51 | +// BaseMap params = new BaseMap(); | |
52 | +// params.put("orderId", "123456"); | |
53 | +// rabbitMqClient.publishEvent(CloudConstant.MQ_DEMO_BUS_EVENT, params); | |
54 | +// return Result.OK("MQ发送消息成功"); | |
55 | +// } | |
61 | 56 | } |
... | ... |
jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/lock/DemoLockTest.java
1 | 1 | package org.jeecg.modules.cloud.lock; |
2 | 2 | |
3 | 3 | import lombok.extern.slf4j.Slf4j; |
4 | -import org.jeecg.boot.starter.lock.annotation.JLock; | |
5 | 4 | import org.jeecg.boot.starter.lock.client.RedissonLockClient; |
6 | -import org.jeecg.boot.starter.rabbitmq.client.RabbitMqClient; | |
7 | -import org.jeecg.common.base.BaseMap; | |
8 | 5 | import org.jeecg.modules.cloud.constant.CloudConstant; |
9 | 6 | import org.springframework.beans.factory.annotation.Autowired; |
10 | -import org.springframework.scheduling.annotation.Scheduled; | |
11 | 7 | import org.springframework.stereotype.Component; |
12 | 8 | |
13 | -import java.util.Map; | |
14 | - | |
15 | 9 | /** |
16 | 10 | * 分布式锁测试demo |
17 | 11 | */ |
... | ... | @@ -20,26 +14,26 @@ import java.util.Map; |
20 | 14 | public class DemoLockTest { |
21 | 15 | @Autowired |
22 | 16 | RedissonLockClient redissonLock; |
23 | - @Autowired | |
24 | - RabbitMqClient rabbitMqClient; | |
25 | - | |
26 | - /** | |
27 | - * 测试分布式锁【注解方式】 | |
28 | - */ | |
29 | - @Scheduled(cron = "0/5 * * * * ?") | |
30 | - @JLock(lockKey = CloudConstant.REDISSON_DEMO_LOCK_KEY1) | |
31 | - public void execute() throws InterruptedException { | |
32 | - log.info("执行execute任务开始,休眠三秒"); | |
33 | - Thread.sleep(3000); | |
34 | - System.out.println("=======================业务逻辑1============================="); | |
35 | - Map map = new BaseMap(); | |
36 | - map.put("orderId", "BJ0001"); | |
37 | - rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map); | |
38 | - //延迟10秒发送 | |
39 | - map.put("orderId", "NJ0002"); | |
40 | - rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map, 10000); | |
41 | - log.info("execute任务结束,休眠三秒"); | |
42 | - } | |
17 | +// @Autowired | |
18 | +// RabbitMqClient rabbitMqClient; | |
19 | + | |
20 | +// /** | |
21 | +// * 测试分布式锁【注解方式】 | |
22 | +// */ | |
23 | +// @Scheduled(cron = "0/5 * * * * ?") | |
24 | +// @JLock(lockKey = CloudConstant.REDISSON_DEMO_LOCK_KEY1) | |
25 | +// public void execute() throws InterruptedException { | |
26 | +// log.info("执行execute任务开始,休眠三秒"); | |
27 | +// Thread.sleep(3000); | |
28 | +// System.out.println("=======================业务逻辑1============================="); | |
29 | +// Map map = new BaseMap(); | |
30 | +// map.put("orderId", "BJ0001"); | |
31 | +// rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map); | |
32 | +// //延迟10秒发送 | |
33 | +// map.put("orderId", "NJ0002"); | |
34 | +// rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map, 10000); | |
35 | +// log.info("execute任务结束,休眠三秒"); | |
36 | +// } | |
43 | 37 | |
44 | 38 | public DemoLockTest() { |
45 | 39 | } |
... | ... |
jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloReceiver1.java
1 | -package org.jeecg.modules.cloud.rabbitmq; | |
2 | - | |
3 | -import com.rabbitmq.client.Channel; | |
4 | -import lombok.extern.slf4j.Slf4j; | |
5 | -import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler; | |
6 | -import org.jeecg.boot.starter.rabbitmq.listenter.MqListener; | |
7 | -import org.jeecg.common.annotation.RabbitComponent; | |
8 | -import org.jeecg.common.base.BaseMap; | |
9 | -import org.jeecg.modules.cloud.constant.CloudConstant; | |
10 | -import org.springframework.amqp.rabbit.annotation.RabbitHandler; | |
11 | -import org.springframework.amqp.rabbit.annotation.RabbitListener; | |
12 | -import org.springframework.amqp.support.AmqpHeaders; | |
13 | -import org.springframework.messaging.handler.annotation.Header; | |
14 | - | |
15 | -/** | |
16 | - * RabbitMq接受者1 | |
17 | - * (@RabbitListener声明类上,一个类只能监听一个队列) | |
18 | - */ | |
19 | -@Slf4j | |
20 | -@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER) | |
21 | -@RabbitComponent(value = "helloReceiver1") | |
22 | -public class HelloReceiver1 extends BaseRabbiMqHandler<BaseMap> { | |
23 | - | |
24 | - @RabbitHandler | |
25 | - public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) { | |
26 | - super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() { | |
27 | - @Override | |
28 | - public void handler(BaseMap map, Channel channel) { | |
29 | - //业务处理 | |
30 | - String orderId = map.get("orderId").toString(); | |
31 | - log.info("MQ Receiver1,orderId : " + orderId); | |
32 | - } | |
33 | - }); | |
34 | - } | |
35 | - | |
36 | -} | |
37 | 1 | \ No newline at end of file |
2 | +//package org.jeecg.modules.cloud.rabbitmq; | |
3 | +// | |
4 | +//import com.rabbitmq.client.Channel; | |
5 | +//import lombok.extern.slf4j.Slf4j; | |
6 | +//import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler; | |
7 | +//import org.jeecg.boot.starter.rabbitmq.listenter.MqListener; | |
8 | +//import org.jeecg.common.annotation.RabbitComponent; | |
9 | +//import org.jeecg.common.base.BaseMap; | |
10 | +//import org.jeecg.modules.cloud.constant.CloudConstant; | |
11 | +//import org.springframework.amqp.rabbit.annotation.RabbitHandler; | |
12 | +//import org.springframework.amqp.rabbit.annotation.RabbitListener; | |
13 | +//import org.springframework.amqp.support.AmqpHeaders; | |
14 | +//import org.springframework.messaging.handler.annotation.Header; | |
15 | +// | |
16 | +///** | |
17 | +// * RabbitMq接受者1 | |
18 | +// * (@RabbitListener声明类上,一个类只能监听一个队列) | |
19 | +// */ | |
20 | +//@Slf4j | |
21 | +//@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER) | |
22 | +//@RabbitComponent(value = "helloReceiver1") | |
23 | +//public class HelloReceiver1 extends BaseRabbiMqHandler<BaseMap> { | |
24 | +// | |
25 | +// @RabbitHandler | |
26 | +// public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) { | |
27 | +// super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() { | |
28 | +// @Override | |
29 | +// public void handler(BaseMap map, Channel channel) { | |
30 | +// //业务处理 | |
31 | +// String orderId = map.get("orderId").toString(); | |
32 | +// log.info("MQ Receiver1,orderId : " + orderId); | |
33 | +// } | |
34 | +// }); | |
35 | +// } | |
36 | +// | |
37 | +//} | |
38 | 38 | \ No newline at end of file |
... | ... |
jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloReceiver2.java
1 | -package org.jeecg.modules.cloud.rabbitmq; | |
2 | - | |
3 | -import com.rabbitmq.client.Channel; | |
4 | -import lombok.extern.slf4j.Slf4j; | |
5 | -import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler; | |
6 | -import org.jeecg.boot.starter.rabbitmq.listenter.MqListener; | |
7 | -import org.jeecg.common.annotation.RabbitComponent; | |
8 | -import org.jeecg.common.base.BaseMap; | |
9 | -import org.jeecg.modules.cloud.constant.CloudConstant; | |
10 | -import org.springframework.amqp.rabbit.annotation.RabbitHandler; | |
11 | -import org.springframework.amqp.rabbit.annotation.RabbitListener; | |
12 | -import org.springframework.amqp.support.AmqpHeaders; | |
13 | -import org.springframework.messaging.handler.annotation.Header; | |
14 | - | |
15 | -/** | |
16 | - * RabbitMq接受者2 | |
17 | - * (@RabbitListener声明类上,一个类只能监听一个队列) | |
18 | - */ | |
19 | -@Slf4j | |
20 | -@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER) | |
21 | -@RabbitComponent(value = "helloReceiver2") | |
22 | -public class HelloReceiver2 extends BaseRabbiMqHandler<BaseMap> { | |
23 | - | |
24 | - @RabbitHandler | |
25 | - public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) { | |
26 | - super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() { | |
27 | - @Override | |
28 | - public void handler(BaseMap map, Channel channel) { | |
29 | - //业务处理 | |
30 | - String orderId = map.get("orderId").toString(); | |
31 | - log.info("MQ Receiver2,orderId : " + orderId); | |
32 | - } | |
33 | - }); | |
34 | - } | |
35 | - | |
36 | -} | |
37 | 1 | \ No newline at end of file |
2 | +//package org.jeecg.modules.cloud.rabbitmq; | |
3 | +// | |
4 | +//import com.rabbitmq.client.Channel; | |
5 | +//import lombok.extern.slf4j.Slf4j; | |
6 | +//import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler; | |
7 | +//import org.jeecg.boot.starter.rabbitmq.listenter.MqListener; | |
8 | +//import org.jeecg.common.annotation.RabbitComponent; | |
9 | +//import org.jeecg.common.base.BaseMap; | |
10 | +//import org.jeecg.modules.cloud.constant.CloudConstant; | |
11 | +//import org.springframework.amqp.rabbit.annotation.RabbitHandler; | |
12 | +//import org.springframework.amqp.rabbit.annotation.RabbitListener; | |
13 | +//import org.springframework.amqp.support.AmqpHeaders; | |
14 | +//import org.springframework.messaging.handler.annotation.Header; | |
15 | +// | |
16 | +///** | |
17 | +// * RabbitMq接受者2 | |
18 | +// * (@RabbitListener声明类上,一个类只能监听一个队列) | |
19 | +// */ | |
20 | +//@Slf4j | |
21 | +//@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER) | |
22 | +//@RabbitComponent(value = "helloReceiver2") | |
23 | +//public class HelloReceiver2 extends BaseRabbiMqHandler<BaseMap> { | |
24 | +// | |
25 | +// @RabbitHandler | |
26 | +// public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) { | |
27 | +// super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() { | |
28 | +// @Override | |
29 | +// public void handler(BaseMap map, Channel channel) { | |
30 | +// //业务处理 | |
31 | +// String orderId = map.get("orderId").toString(); | |
32 | +// log.info("MQ Receiver2,orderId : " + orderId); | |
33 | +// } | |
34 | +// }); | |
35 | +// } | |
36 | +// | |
37 | +//} | |
38 | 38 | \ No newline at end of file |
... | ... |
jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloReceiver3.java
1 | -package org.jeecg.modules.cloud.rabbitmq; | |
2 | - | |
3 | -import com.rabbitmq.client.Channel; | |
4 | -import lombok.extern.slf4j.Slf4j; | |
5 | -import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler; | |
6 | -import org.jeecg.boot.starter.rabbitmq.listenter.MqListener; | |
7 | -import org.jeecg.common.annotation.RabbitComponent; | |
8 | -import org.jeecg.common.base.BaseMap; | |
9 | -import org.jeecg.modules.cloud.constant.CloudConstant; | |
10 | -import org.springframework.amqp.rabbit.annotation.RabbitHandler; | |
11 | -import org.springframework.amqp.rabbit.annotation.RabbitListener; | |
12 | -import org.springframework.amqp.support.AmqpHeaders; | |
13 | -import org.springframework.messaging.handler.annotation.Header; | |
14 | - | |
15 | -/** | |
16 | - * RabbitMq接受者3 | |
17 | - * (@RabbitListener声明类方法上,一个类可以多监听多个队列) | |
18 | - */ | |
19 | -@Slf4j | |
20 | -@RabbitComponent(value = "helloReceiver3") | |
21 | -public class HelloReceiver3 extends BaseRabbiMqHandler<BaseMap> { | |
22 | - | |
23 | - @RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER) | |
24 | - public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) { | |
25 | - super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() { | |
26 | - @Override | |
27 | - public void handler(BaseMap map, Channel channel) { | |
28 | - //业务处理 | |
29 | - String orderId = map.get("orderId").toString(); | |
30 | - log.info("MQ Receiver3,orderId : " + orderId); | |
31 | - } | |
32 | - }); | |
33 | - } | |
34 | - | |
35 | -} | |
36 | 1 | \ No newline at end of file |
2 | +//package org.jeecg.modules.cloud.rabbitmq; | |
3 | +// | |
4 | +//import com.rabbitmq.client.Channel; | |
5 | +//import lombok.extern.slf4j.Slf4j; | |
6 | +//import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler; | |
7 | +//import org.jeecg.boot.starter.rabbitmq.listenter.MqListener; | |
8 | +//import org.jeecg.common.annotation.RabbitComponent; | |
9 | +//import org.jeecg.common.base.BaseMap; | |
10 | +//import org.jeecg.modules.cloud.constant.CloudConstant; | |
11 | +//import org.springframework.amqp.rabbit.annotation.RabbitHandler; | |
12 | +//import org.springframework.amqp.rabbit.annotation.RabbitListener; | |
13 | +//import org.springframework.amqp.support.AmqpHeaders; | |
14 | +//import org.springframework.messaging.handler.annotation.Header; | |
15 | +// | |
16 | +///** | |
17 | +// * RabbitMq接受者3 | |
18 | +// * (@RabbitListener声明类方法上,一个类可以多监听多个队列) | |
19 | +// */ | |
20 | +//@Slf4j | |
21 | +//@RabbitComponent(value = "helloReceiver3") | |
22 | +//public class HelloReceiver3 extends BaseRabbiMqHandler<BaseMap> { | |
23 | +// | |
24 | +// @RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER) | |
25 | +// public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) { | |
26 | +// super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() { | |
27 | +// @Override | |
28 | +// public void handler(BaseMap map, Channel channel) { | |
29 | +// //业务处理 | |
30 | +// String orderId = map.get("orderId").toString(); | |
31 | +// log.info("MQ Receiver3,orderId : " + orderId); | |
32 | +// } | |
33 | +// }); | |
34 | +// } | |
35 | +// | |
36 | +//} | |
37 | 37 | \ No newline at end of file |
... | ... |
jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/modules/cloud/rabbitmq/HelloTimeReceiver.java
1 | -package org.jeecg.modules.cloud.rabbitmq; | |
2 | - | |
3 | -import com.rabbitmq.client.Channel; | |
4 | -import lombok.extern.slf4j.Slf4j; | |
5 | -import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler; | |
6 | -import org.jeecg.boot.starter.rabbitmq.listenter.MqListener; | |
7 | -import org.jeecg.common.annotation.RabbitComponent; | |
8 | -import org.jeecg.common.base.BaseMap; | |
9 | -import org.jeecg.modules.cloud.constant.CloudConstant; | |
10 | -import org.springframework.amqp.rabbit.annotation.RabbitHandler; | |
11 | -import org.springframework.amqp.rabbit.annotation.RabbitListener; | |
12 | -import org.springframework.amqp.support.AmqpHeaders; | |
13 | -import org.springframework.messaging.handler.annotation.Header; | |
14 | - | |
15 | -@Slf4j | |
16 | -@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER_TIME) | |
17 | -@RabbitComponent(value = "helloTimeReceiver") | |
18 | -public class HelloTimeReceiver extends BaseRabbiMqHandler<BaseMap> { | |
19 | - | |
20 | - @RabbitHandler | |
21 | - public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) { | |
22 | - super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() { | |
23 | - @Override | |
24 | - public void handler(BaseMap map, Channel channel) { | |
25 | - //业务处理 | |
26 | - String orderId = map.get("orderId").toString(); | |
27 | - log.info("Time Receiver1,orderId : " + orderId); | |
28 | - } | |
29 | - }); | |
30 | - } | |
31 | - | |
32 | -} | |
33 | 1 | \ No newline at end of file |
2 | +//package org.jeecg.modules.cloud.rabbitmq; | |
3 | +// | |
4 | +//import com.rabbitmq.client.Channel; | |
5 | +//import lombok.extern.slf4j.Slf4j; | |
6 | +//import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler; | |
7 | +//import org.jeecg.boot.starter.rabbitmq.listenter.MqListener; | |
8 | +//import org.jeecg.common.annotation.RabbitComponent; | |
9 | +//import org.jeecg.common.base.BaseMap; | |
10 | +//import org.jeecg.modules.cloud.constant.CloudConstant; | |
11 | +//import org.springframework.amqp.rabbit.annotation.RabbitHandler; | |
12 | +//import org.springframework.amqp.rabbit.annotation.RabbitListener; | |
13 | +//import org.springframework.amqp.support.AmqpHeaders; | |
14 | +//import org.springframework.messaging.handler.annotation.Header; | |
15 | +// | |
16 | +//@Slf4j | |
17 | +//@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER_TIME) | |
18 | +//@RabbitComponent(value = "helloTimeReceiver") | |
19 | +//public class HelloTimeReceiver extends BaseRabbiMqHandler<BaseMap> { | |
20 | +// | |
21 | +// @RabbitHandler | |
22 | +// public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) { | |
23 | +// super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() { | |
24 | +// @Override | |
25 | +// public void handler(BaseMap map, Channel channel) { | |
26 | +// //业务处理 | |
27 | +// String orderId = map.get("orderId").toString(); | |
28 | +// log.info("Time Receiver1,orderId : " + orderId); | |
29 | +// } | |
30 | +// }); | |
31 | +// } | |
32 | +// | |
33 | +//} | |
34 | 34 | \ No newline at end of file |
... | ... |