mirror of https://github.com/jeecgboot/jeecg-boot
parent
758c347eb0
commit
51c63e8057
|
@ -30,11 +30,11 @@
|
||||||
<artifactId>jeecg-boot-module-system</artifactId>
|
<artifactId>jeecg-boot-module-system</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--rabbitmq消息队列-->
|
<!--rabbitmq消息队列
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
<artifactId>jeecg-boot-starter-rabbitmq</artifactId>
|
<artifactId>jeecg-boot-starter-rabbitmq</artifactId>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
<!--xxl-job定时任务-->
|
<!--xxl-job定时任务-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jeecgframework.boot</groupId>
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
package org.jeecg.modules.cloud.ebus;
|
//package org.jeecg.modules.cloud.ebus;
|
||||||
|
//
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
//import cn.hutool.core.util.ObjectUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.boot.starter.rabbitmq.event.EventObj;
|
//import org.jeecg.boot.starter.rabbitmq.event.EventObj;
|
||||||
import org.jeecg.boot.starter.rabbitmq.event.JeecgBusEventHandler;
|
//import org.jeecg.boot.starter.rabbitmq.event.JeecgBusEventHandler;
|
||||||
import org.jeecg.common.base.BaseMap;
|
//import org.jeecg.common.base.BaseMap;
|
||||||
import org.jeecg.modules.cloud.constant.CloudConstant;
|
//import org.jeecg.modules.cloud.constant.CloudConstant;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 消息处理器【发布订阅】
|
// * 消息处理器【发布订阅】
|
||||||
*/
|
// */
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
@Component(CloudConstant.MQ_DEMO_BUS_EVENT)
|
//@Component(CloudConstant.MQ_DEMO_BUS_EVENT)
|
||||||
public class DemoBusEvent implements JeecgBusEventHandler {
|
//public class DemoBusEvent implements JeecgBusEventHandler {
|
||||||
|
//
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onMessage(EventObj obj) {
|
// public void onMessage(EventObj obj) {
|
||||||
if (ObjectUtil.isNotEmpty(obj)) {
|
// if (ObjectUtil.isNotEmpty(obj)) {
|
||||||
BaseMap baseMap = obj.getBaseMap();
|
// BaseMap baseMap = obj.getBaseMap();
|
||||||
String orderId = baseMap.get("orderId");
|
// String orderId = baseMap.get("orderId");
|
||||||
log.info("业务处理----订单ID:" + orderId);
|
// log.info("业务处理----订单ID:" + orderId);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package org.jeecg.modules.cloud.feign.controller;
|
package org.jeecg.modules.cloud.feign.controller;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.RandomUtil;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.jeecg.boot.starter.rabbitmq.client.RabbitMqClient;
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
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.constant.CloudConstant;
|
||||||
import org.jeecg.modules.cloud.feign.feign.JeecgTestClient;
|
import org.jeecg.modules.cloud.feign.feign.JeecgTestClient;
|
||||||
import org.jeecg.modules.cloud.feign.feign.JeecgTestClientDyn;
|
import org.jeecg.modules.cloud.feign.feign.JeecgTestClientDyn;
|
||||||
|
@ -16,8 +13,6 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/sys/test")
|
@RequestMapping("/sys/test")
|
||||||
@Api(tags = "【微服务】单元测试")
|
@Api(tags = "【微服务】单元测试")
|
||||||
|
@ -27,8 +22,8 @@ public class JeecgTestFeignController {
|
||||||
private JeecgFeignService jeecgFeignService;
|
private JeecgFeignService jeecgFeignService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private JeecgTestClient jeecgTestClient;
|
private JeecgTestClient jeecgTestClient;
|
||||||
@Autowired
|
// @Autowired
|
||||||
private RabbitMqClient rabbitMqClient;
|
// private RabbitMqClient rabbitMqClient;
|
||||||
|
|
||||||
@GetMapping("getMessage")
|
@GetMapping("getMessage")
|
||||||
@ApiOperation(value = "测试feign", notes = "测试feign")
|
@ApiOperation(value = "测试feign", notes = "测试feign")
|
||||||
|
@ -43,19 +38,19 @@ public class JeecgTestFeignController {
|
||||||
return myClientDyn.getMessage("动态fegin——jeecg-boot2");
|
return myClientDyn.getMessage("动态fegin——jeecg-boot2");
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/rabbitmq")
|
// @GetMapping(value = "/rabbitmq")
|
||||||
@ApiOperation(value = "测试rabbitmq", notes = "测试rabbitmq")
|
// @ApiOperation(value = "测试rabbitmq", notes = "测试rabbitmq")
|
||||||
public Result<?> rabbitMqClientTest(HttpServletRequest req) {
|
// public Result<?> rabbitMqClientTest(HttpServletRequest req) {
|
||||||
//rabbitmq消息队列测试
|
// //rabbitmq消息队列测试
|
||||||
BaseMap map = new BaseMap();
|
// BaseMap map = new BaseMap();
|
||||||
map.put("orderId", RandomUtil.randomNumbers(10));
|
// map.put("orderId", RandomUtil.randomNumbers(10));
|
||||||
rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map);
|
// rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map);
|
||||||
rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER_TIME, map,10);
|
// rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER_TIME, map,10);
|
||||||
|
//
|
||||||
//rabbitmq消息总线测试
|
// //rabbitmq消息总线测试
|
||||||
BaseMap params = new BaseMap();
|
// BaseMap params = new BaseMap();
|
||||||
params.put("orderId", "123456");
|
// params.put("orderId", "123456");
|
||||||
rabbitMqClient.publishEvent(CloudConstant.MQ_DEMO_BUS_EVENT, params);
|
// rabbitMqClient.publishEvent(CloudConstant.MQ_DEMO_BUS_EVENT, params);
|
||||||
return Result.OK("MQ发送消息成功");
|
// return Result.OK("MQ发送消息成功");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,11 @@
|
||||||
package org.jeecg.modules.cloud.lock;
|
package org.jeecg.modules.cloud.lock;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.boot.starter.lock.annotation.JLock;
|
|
||||||
import org.jeecg.boot.starter.lock.client.RedissonLockClient;
|
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.jeecg.modules.cloud.constant.CloudConstant;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分布式锁测试demo
|
* 分布式锁测试demo
|
||||||
*/
|
*/
|
||||||
|
@ -20,26 +14,26 @@ import java.util.Map;
|
||||||
public class DemoLockTest {
|
public class DemoLockTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
RedissonLockClient redissonLock;
|
RedissonLockClient redissonLock;
|
||||||
@Autowired
|
// @Autowired
|
||||||
RabbitMqClient rabbitMqClient;
|
// RabbitMqClient rabbitMqClient;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 测试分布式锁【注解方式】
|
// * 测试分布式锁【注解方式】
|
||||||
*/
|
// */
|
||||||
@Scheduled(cron = "0/5 * * * * ?")
|
// @Scheduled(cron = "0/5 * * * * ?")
|
||||||
@JLock(lockKey = CloudConstant.REDISSON_DEMO_LOCK_KEY1)
|
// @JLock(lockKey = CloudConstant.REDISSON_DEMO_LOCK_KEY1)
|
||||||
public void execute() throws InterruptedException {
|
// public void execute() throws InterruptedException {
|
||||||
log.info("执行execute任务开始,休眠三秒");
|
// log.info("执行execute任务开始,休眠三秒");
|
||||||
Thread.sleep(3000);
|
// Thread.sleep(3000);
|
||||||
System.out.println("=======================业务逻辑1=============================");
|
// System.out.println("=======================业务逻辑1=============================");
|
||||||
Map map = new BaseMap();
|
// Map map = new BaseMap();
|
||||||
map.put("orderId", "BJ0001");
|
// map.put("orderId", "BJ0001");
|
||||||
rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map);
|
// rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map);
|
||||||
//延迟10秒发送
|
// //延迟10秒发送
|
||||||
map.put("orderId", "NJ0002");
|
// map.put("orderId", "NJ0002");
|
||||||
rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map, 10000);
|
// rabbitMqClient.sendMessage(CloudConstant.MQ_JEECG_PLACE_ORDER, map, 10000);
|
||||||
log.info("execute任务结束,休眠三秒");
|
// log.info("execute任务结束,休眠三秒");
|
||||||
}
|
// }
|
||||||
|
|
||||||
public DemoLockTest() {
|
public DemoLockTest() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
package org.jeecg.modules.cloud.rabbitmq;
|
//package org.jeecg.modules.cloud.rabbitmq;
|
||||||
|
//
|
||||||
import com.rabbitmq.client.Channel;
|
//import com.rabbitmq.client.Channel;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
|
//import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
|
||||||
import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
|
//import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
|
||||||
import org.jeecg.common.annotation.RabbitComponent;
|
//import org.jeecg.common.annotation.RabbitComponent;
|
||||||
import org.jeecg.common.base.BaseMap;
|
//import org.jeecg.common.base.BaseMap;
|
||||||
import org.jeecg.modules.cloud.constant.CloudConstant;
|
//import org.jeecg.modules.cloud.constant.CloudConstant;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
import org.springframework.amqp.support.AmqpHeaders;
|
//import org.springframework.amqp.support.AmqpHeaders;
|
||||||
import org.springframework.messaging.handler.annotation.Header;
|
//import org.springframework.messaging.handler.annotation.Header;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* RabbitMq接受者1
|
// * RabbitMq接受者1
|
||||||
* (@RabbitListener声明类上,一个类只能监听一个队列)
|
// * (@RabbitListener声明类上,一个类只能监听一个队列)
|
||||||
*/
|
// */
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER)
|
//@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER)
|
||||||
@RabbitComponent(value = "helloReceiver1")
|
//@RabbitComponent(value = "helloReceiver1")
|
||||||
public class HelloReceiver1 extends BaseRabbiMqHandler<BaseMap> {
|
//public class HelloReceiver1 extends BaseRabbiMqHandler<BaseMap> {
|
||||||
|
//
|
||||||
@RabbitHandler
|
// @RabbitHandler
|
||||||
public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
// public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
||||||
super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() {
|
// super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() {
|
||||||
@Override
|
// @Override
|
||||||
public void handler(BaseMap map, Channel channel) {
|
// public void handler(BaseMap map, Channel channel) {
|
||||||
//业务处理
|
// //业务处理
|
||||||
String orderId = map.get("orderId").toString();
|
// String orderId = map.get("orderId").toString();
|
||||||
log.info("MQ Receiver1,orderId : " + orderId);
|
// log.info("MQ Receiver1,orderId : " + orderId);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
|
@ -1,36 +1,36 @@
|
||||||
package org.jeecg.modules.cloud.rabbitmq;
|
//package org.jeecg.modules.cloud.rabbitmq;
|
||||||
|
//
|
||||||
import com.rabbitmq.client.Channel;
|
//import com.rabbitmq.client.Channel;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
|
//import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
|
||||||
import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
|
//import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
|
||||||
import org.jeecg.common.annotation.RabbitComponent;
|
//import org.jeecg.common.annotation.RabbitComponent;
|
||||||
import org.jeecg.common.base.BaseMap;
|
//import org.jeecg.common.base.BaseMap;
|
||||||
import org.jeecg.modules.cloud.constant.CloudConstant;
|
//import org.jeecg.modules.cloud.constant.CloudConstant;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
import org.springframework.amqp.support.AmqpHeaders;
|
//import org.springframework.amqp.support.AmqpHeaders;
|
||||||
import org.springframework.messaging.handler.annotation.Header;
|
//import org.springframework.messaging.handler.annotation.Header;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* RabbitMq接受者2
|
// * RabbitMq接受者2
|
||||||
* (@RabbitListener声明类上,一个类只能监听一个队列)
|
// * (@RabbitListener声明类上,一个类只能监听一个队列)
|
||||||
*/
|
// */
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER)
|
//@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER)
|
||||||
@RabbitComponent(value = "helloReceiver2")
|
//@RabbitComponent(value = "helloReceiver2")
|
||||||
public class HelloReceiver2 extends BaseRabbiMqHandler<BaseMap> {
|
//public class HelloReceiver2 extends BaseRabbiMqHandler<BaseMap> {
|
||||||
|
//
|
||||||
@RabbitHandler
|
// @RabbitHandler
|
||||||
public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
// public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
||||||
super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() {
|
// super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() {
|
||||||
@Override
|
// @Override
|
||||||
public void handler(BaseMap map, Channel channel) {
|
// public void handler(BaseMap map, Channel channel) {
|
||||||
//业务处理
|
// //业务处理
|
||||||
String orderId = map.get("orderId").toString();
|
// String orderId = map.get("orderId").toString();
|
||||||
log.info("MQ Receiver2,orderId : " + orderId);
|
// log.info("MQ Receiver2,orderId : " + orderId);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
|
@ -1,35 +1,35 @@
|
||||||
package org.jeecg.modules.cloud.rabbitmq;
|
//package org.jeecg.modules.cloud.rabbitmq;
|
||||||
|
//
|
||||||
import com.rabbitmq.client.Channel;
|
//import com.rabbitmq.client.Channel;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
|
//import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
|
||||||
import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
|
//import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
|
||||||
import org.jeecg.common.annotation.RabbitComponent;
|
//import org.jeecg.common.annotation.RabbitComponent;
|
||||||
import org.jeecg.common.base.BaseMap;
|
//import org.jeecg.common.base.BaseMap;
|
||||||
import org.jeecg.modules.cloud.constant.CloudConstant;
|
//import org.jeecg.modules.cloud.constant.CloudConstant;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
import org.springframework.amqp.support.AmqpHeaders;
|
//import org.springframework.amqp.support.AmqpHeaders;
|
||||||
import org.springframework.messaging.handler.annotation.Header;
|
//import org.springframework.messaging.handler.annotation.Header;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* RabbitMq接受者3
|
// * RabbitMq接受者3
|
||||||
* (@RabbitListener声明类方法上,一个类可以多监听多个队列)
|
// * (@RabbitListener声明类方法上,一个类可以多监听多个队列)
|
||||||
*/
|
// */
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
@RabbitComponent(value = "helloReceiver3")
|
//@RabbitComponent(value = "helloReceiver3")
|
||||||
public class HelloReceiver3 extends BaseRabbiMqHandler<BaseMap> {
|
//public class HelloReceiver3 extends BaseRabbiMqHandler<BaseMap> {
|
||||||
|
//
|
||||||
@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER)
|
// @RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER)
|
||||||
public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
// public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
||||||
super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() {
|
// super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() {
|
||||||
@Override
|
// @Override
|
||||||
public void handler(BaseMap map, Channel channel) {
|
// public void handler(BaseMap map, Channel channel) {
|
||||||
//业务处理
|
// //业务处理
|
||||||
String orderId = map.get("orderId").toString();
|
// String orderId = map.get("orderId").toString();
|
||||||
log.info("MQ Receiver3,orderId : " + orderId);
|
// log.info("MQ Receiver3,orderId : " + orderId);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
|
@ -1,32 +1,32 @@
|
||||||
package org.jeecg.modules.cloud.rabbitmq;
|
//package org.jeecg.modules.cloud.rabbitmq;
|
||||||
|
//
|
||||||
import com.rabbitmq.client.Channel;
|
//import com.rabbitmq.client.Channel;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
|
//import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
|
||||||
import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
|
//import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
|
||||||
import org.jeecg.common.annotation.RabbitComponent;
|
//import org.jeecg.common.annotation.RabbitComponent;
|
||||||
import org.jeecg.common.base.BaseMap;
|
//import org.jeecg.common.base.BaseMap;
|
||||||
import org.jeecg.modules.cloud.constant.CloudConstant;
|
//import org.jeecg.modules.cloud.constant.CloudConstant;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
import org.springframework.amqp.support.AmqpHeaders;
|
//import org.springframework.amqp.support.AmqpHeaders;
|
||||||
import org.springframework.messaging.handler.annotation.Header;
|
//import org.springframework.messaging.handler.annotation.Header;
|
||||||
|
//
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER_TIME)
|
//@RabbitListener(queues = CloudConstant.MQ_JEECG_PLACE_ORDER_TIME)
|
||||||
@RabbitComponent(value = "helloTimeReceiver")
|
//@RabbitComponent(value = "helloTimeReceiver")
|
||||||
public class HelloTimeReceiver extends BaseRabbiMqHandler<BaseMap> {
|
//public class HelloTimeReceiver extends BaseRabbiMqHandler<BaseMap> {
|
||||||
|
//
|
||||||
@RabbitHandler
|
// @RabbitHandler
|
||||||
public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
// public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
||||||
super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() {
|
// super.onMessage(baseMap, deliveryTag, channel, new MqListener<BaseMap>() {
|
||||||
@Override
|
// @Override
|
||||||
public void handler(BaseMap map, Channel channel) {
|
// public void handler(BaseMap map, Channel channel) {
|
||||||
//业务处理
|
// //业务处理
|
||||||
String orderId = map.get("orderId").toString();
|
// String orderId = map.get("orderId").toString();
|
||||||
log.info("Time Receiver1,orderId : " + orderId);
|
// log.info("Time Receiver1,orderId : " + orderId);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
|
@ -363,7 +363,7 @@
|
||||||
<!--配置文件前缀-->
|
<!--配置文件前缀-->
|
||||||
<prefix.name>jeecg</prefix.name>
|
<prefix.name>jeecg</prefix.name>
|
||||||
<!--Nacos配置中心地址-->
|
<!--Nacos配置中心地址-->
|
||||||
<config.server-addr>127.0.0.1:8848</config.server-addr>
|
<config.server-addr>jeecg-boot-nacos:8848</config.server-addr>
|
||||||
<!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID,不能使用名称,默认为空-->
|
<!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID,不能使用名称,默认为空-->
|
||||||
<config.namespace></config.namespace>
|
<config.namespace></config.namespace>
|
||||||
<!--Nacos用户名-->
|
<!--Nacos用户名-->
|
||||||
|
@ -373,7 +373,7 @@
|
||||||
<!--Nacos配置分组名称-->
|
<!--Nacos配置分组名称-->
|
||||||
<config.group>DEFAULT_GROUP</config.group>
|
<config.group>DEFAULT_GROUP</config.group>
|
||||||
<!--Nacos服务发现地址-->
|
<!--Nacos服务发现地址-->
|
||||||
<discovery.server-addr>127.0.0.1:8848</discovery.server-addr>
|
<discovery.server-addr>jeecg-boot-nacos:8848</discovery.server-addr>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
<!-- 测试 -->
|
<!-- 测试 -->
|
||||||
|
@ -385,7 +385,7 @@
|
||||||
<!--配置文件前缀-->
|
<!--配置文件前缀-->
|
||||||
<prefix.name>jeecg</prefix.name>
|
<prefix.name>jeecg</prefix.name>
|
||||||
<!--Nacos配置中心地址-->
|
<!--Nacos配置中心地址-->
|
||||||
<config.server-addr>127.0.0.1:8848</config.server-addr>
|
<config.server-addr>jeecg-boot-nacos:8848</config.server-addr>
|
||||||
<!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID,不能使用名称,默认为空-->
|
<!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID,不能使用名称,默认为空-->
|
||||||
<config.namespace></config.namespace>
|
<config.namespace></config.namespace>
|
||||||
<!--Nacos用户名-->
|
<!--Nacos用户名-->
|
||||||
|
@ -395,7 +395,7 @@
|
||||||
<!--Nacos配置分组名称-->
|
<!--Nacos配置分组名称-->
|
||||||
<config.group>DEFAULT_GROUP</config.group>
|
<config.group>DEFAULT_GROUP</config.group>
|
||||||
<!--Nacos服务发现地址-->
|
<!--Nacos服务发现地址-->
|
||||||
<discovery.server-addr>127.0.0.1:8848</discovery.server-addr>
|
<discovery.server-addr>jeecg-boot-nacos:8848</discovery.server-addr>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
<!-- 生产 -->
|
<!-- 生产 -->
|
||||||
|
@ -407,7 +407,7 @@
|
||||||
<!--配置文件前缀-->
|
<!--配置文件前缀-->
|
||||||
<prefix.name>jeecg</prefix.name>
|
<prefix.name>jeecg</prefix.name>
|
||||||
<!--Nacos配置中心地址-->
|
<!--Nacos配置中心地址-->
|
||||||
<config.server-addr>127.0.0.1:8848</config.server-addr>
|
<config.server-addr>jeecg-boot-nacos:8848</config.server-addr>
|
||||||
<!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID,不能使用名称,默认为空-->
|
<!--Nacos配置中心命名空间,用于支持多环境.这里必须使用ID,不能使用名称,默认为空-->
|
||||||
<config.namespace></config.namespace>
|
<config.namespace></config.namespace>
|
||||||
<!--Nacos用户名-->
|
<!--Nacos用户名-->
|
||||||
|
@ -417,7 +417,7 @@
|
||||||
<!--Nacos配置分组名称-->
|
<!--Nacos配置分组名称-->
|
||||||
<config.group>DEFAULT_GROUP</config.group>
|
<config.group>DEFAULT_GROUP</config.group>
|
||||||
<!--Nacos服务发现地址-->
|
<!--Nacos服务发现地址-->
|
||||||
<discovery.server-addr>127.0.0.1:8848</discovery.server-addr>
|
<discovery.server-addr>jeecg-boot-nacos:8848</discovery.server-addr>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
|
|
Loading…
Reference in New Issue