Commit c81fa840 authored by maoying's avatar maoying

添加rocketmq测试接口

parent e194d4ff
package com.yeejoin.amos.fas.business.controller; package com.yeejoin.amos.fas.business.controller;
import java.util.List; import java.util.List;
import java.util.Map;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -318,4 +320,19 @@ public class View3dController extends BaseController { ...@@ -318,4 +320,19 @@ public class View3dController extends BaseController {
return CommonResponseUtil.success(view3dService.listPointsByRegionId(regionId,type)); return CommonResponseUtil.success(view3dService.listPointsByRegionId(regionId,type));
} }
@Autowired
private RocketMQTemplate rocketMQTemplate;
@ApiOperation(value = "rocketMQ消息推送测试", notes = "rocketMQ消息推送测试")
@PostMapping(value="rocketMQ/send")
public CommonResponse rocketMQTemplate(@RequestParam(required = true, defaultValue = "all") String topic,
@RequestBody Map msg) {
try {
rocketMQTemplate.convertAndSend(topic, msg);
} catch (Exception e) {
return CommonResponseUtil.failure(e.getMessage());
}
return CommonResponseUtil.success(msg);
}
} }
...@@ -51,7 +51,7 @@ emqx.user-name=admin ...@@ -51,7 +51,7 @@ emqx.user-name=admin
emqx.password=public emqx.password=public
#rocketmq生产者配置 #rocketmq生产者配置
rocketmq.name-server=localhost:9876 rocketmq.name-server=172.16.3.51:9876
rocketmq.producer.group=my-group rocketmq.producer.group=my-group
rocketmq.producer.sendMessageTimeout=300000 rocketmq.producer.sendMessageTimeout=300000
rocket-plan-topic=template_topic rocket-plan-topic=template_topic
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment