初始化v1.2
This commit is contained in:
+105
@@ -0,0 +1,105 @@
|
||||
package com.tongran.mtragent.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.tongran.common.log.annotation.Log;
|
||||
import com.tongran.common.log.enums.BusinessType;
|
||||
import com.tongran.common.security.annotation.RequiresPermissions;
|
||||
import com.tongran.mtragent.domain.AllMtrClient;
|
||||
import com.tongran.mtragent.service.IAllMtrClientService;
|
||||
import com.tongran.common.core.web.controller.BaseController;
|
||||
import com.tongran.common.core.web.domain.AjaxResult;
|
||||
import com.tongran.common.core.utils.poi.ExcelUtil;
|
||||
import com.tongran.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* mtr探测丢包clinetId记录Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-11-24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/allMtrClient")
|
||||
public class AllMtrClientController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAllMtrClientService allMtrClientService;
|
||||
|
||||
/**
|
||||
* 查询mtr探测丢包clinetId记录列表
|
||||
*/
|
||||
@RequiresPermissions("mtragent:allMtrClient:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AllMtrClient allMtrClient)
|
||||
{
|
||||
startPage();
|
||||
List<AllMtrClient> list = allMtrClientService.selectAllMtrClientList(allMtrClient);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出mtr探测丢包clinetId记录列表
|
||||
*/
|
||||
@RequiresPermissions("mtragent:allMtrClient:export")
|
||||
@Log(title = "mtr探测丢包clinetId记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AllMtrClient allMtrClient)
|
||||
{
|
||||
List<AllMtrClient> list = allMtrClientService.selectAllMtrClientList(allMtrClient);
|
||||
ExcelUtil<AllMtrClient> util = new ExcelUtil<AllMtrClient>(AllMtrClient.class);
|
||||
util.exportExcel(response, list, "mtr探测丢包clinetId记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取mtr探测丢包clinetId记录详细信息
|
||||
*/
|
||||
@RequiresPermissions("mtragent:allMtrClient:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(allMtrClientService.selectAllMtrClientById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增mtr探测丢包clinetId记录
|
||||
*/
|
||||
@RequiresPermissions("mtragent:allMtrClient:add")
|
||||
@Log(title = "mtr探测丢包clinetId记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AllMtrClient allMtrClient)
|
||||
{
|
||||
return toAjax(allMtrClientService.insertAllMtrClient(allMtrClient));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改mtr探测丢包clinetId记录
|
||||
*/
|
||||
@RequiresPermissions("mtragent:allMtrClient:edit")
|
||||
@Log(title = "mtr探测丢包clinetId记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AllMtrClient allMtrClient)
|
||||
{
|
||||
return toAjax(allMtrClientService.updateAllMtrClient(allMtrClient));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除mtr探测丢包clinetId记录
|
||||
*/
|
||||
@RequiresPermissions("mtragent:allMtrClient:remove")
|
||||
@Log(title = "mtr探测丢包clinetId记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(allMtrClientService.deleteAllMtrClientByIds(ids));
|
||||
}
|
||||
}
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
package com.tongran.mtragent.controller;
|
||||
|
||||
import com.tongran.common.core.utils.poi.ExcelUtil;
|
||||
import com.tongran.common.core.web.controller.BaseController;
|
||||
import com.tongran.common.core.web.domain.AjaxResult;
|
||||
import com.tongran.common.core.web.page.PageDomain;
|
||||
import com.tongran.common.core.web.page.TableDataInfo;
|
||||
import com.tongran.common.log.annotation.Log;
|
||||
import com.tongran.common.log.enums.BusinessType;
|
||||
import com.tongran.common.security.annotation.RequiresPermissions;
|
||||
import com.tongran.mtragent.domain.AllMtrClient;
|
||||
import com.tongran.mtragent.domain.RmMtrClientRegistration;
|
||||
import com.tongran.mtragent.service.IRmMtrClientRegistrationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* MTR客户端注册Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-11-18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mtrClientRegistration")
|
||||
public class RmMtrClientRegistrationController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmMtrClientRegistrationService rmMtrClientRegistrationService;
|
||||
|
||||
/**
|
||||
* 查询MTR客户端注册列表
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrClientRegistration:list")
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody RmMtrClientRegistration rmMtrClientRegistration)
|
||||
{
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(rmMtrClientRegistration.getPageNum());
|
||||
pageDomain.setPageSize(rmMtrClientRegistration.getPageSize());
|
||||
startPage(pageDomain);
|
||||
List<RmMtrClientRegistration> list = rmMtrClientRegistrationService.selectRmMtrClientRegistrationList(rmMtrClientRegistration);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出MTR客户端注册列表
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrClientRegistration:export")
|
||||
@Log(title = "MTR客户端注册", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, @RequestBody RmMtrClientRegistration rmMtrClientRegistration)
|
||||
{
|
||||
List<RmMtrClientRegistration> list = rmMtrClientRegistrationService.selectRmMtrClientRegistrationList(rmMtrClientRegistration);
|
||||
ExcelUtil<RmMtrClientRegistration> util = new ExcelUtil<RmMtrClientRegistration>(RmMtrClientRegistration.class);
|
||||
util.showColumn(rmMtrClientRegistration.getProperties());
|
||||
util.exportExcel(response, list, "MTR客户端注册数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取MTR客户端注册详细信息
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrClientRegistration:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmMtrClientRegistrationService.selectRmMtrClientRegistrationById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增MTR客户端注册
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrClientRegistration:add")
|
||||
@Log(title = "MTR客户端注册", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmMtrClientRegistration rmMtrClientRegistration)
|
||||
{
|
||||
return toAjax(rmMtrClientRegistrationService.insertRmMtrClientRegistration(rmMtrClientRegistration));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改MTR客户端注册
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrClientRegistration:edit")
|
||||
@Log(title = "MTR客户端注册", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmMtrClientRegistration rmMtrClientRegistration)
|
||||
{
|
||||
return toAjax(rmMtrClientRegistrationService.updateRmMtrClientRegistration(rmMtrClientRegistration));
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置更新策略
|
||||
* @param rmMtrClientRegistration
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrClientRegistration:add")
|
||||
@PostMapping("/addAgentUpdatePolicy")
|
||||
public AjaxResult addAgentUpdatePolicy(@RequestBody RmMtrClientRegistration rmMtrClientRegistration){
|
||||
int rows = rmMtrClientRegistrationService.addAgentUpdatePolicy(rmMtrClientRegistration);
|
||||
return toAjax(rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有MTR客户端注册
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrClientRegistration:list")
|
||||
@PostMapping("/getAllMtrMsg")
|
||||
public AjaxResult getAllMtrMsg(@RequestBody RmMtrClientRegistration rmMtrClientRegistration)
|
||||
{
|
||||
List<RmMtrClientRegistration> list = rmMtrClientRegistrationService.selectRmMtrClientRegistrationList(rmMtrClientRegistration);
|
||||
return success(list);
|
||||
}
|
||||
/**
|
||||
* 查询MTR客户端注册列表
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrClientRegistration:list")
|
||||
@PostMapping("/getAllLogicalNode")
|
||||
public AjaxResult getAllLogicalNode(@RequestBody RmMtrClientRegistration rmMtrClientRegistration)
|
||||
{
|
||||
List<RmMtrClientRegistration> list = rmMtrClientRegistrationService.getAllLogicalNode(rmMtrClientRegistration);
|
||||
return success(list);
|
||||
}
|
||||
/**
|
||||
* 根据mtrClientId查询包含的clientId
|
||||
* @param rmMtrClientRegistration
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrClientRegistration:list")
|
||||
@PostMapping("/getClientIdByMtrClientId")
|
||||
public AjaxResult getClientIdByMtrClientId(@RequestBody RmMtrClientRegistration rmMtrClientRegistration)
|
||||
{
|
||||
List<AllMtrClient> list = rmMtrClientRegistrationService.getClientIdByMtrClientId(rmMtrClientRegistration);
|
||||
return success(list);
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.tongran.mtragent.controller;
|
||||
|
||||
import com.tongran.common.core.utils.poi.ExcelUtil;
|
||||
import com.tongran.common.core.web.controller.BaseController;
|
||||
import com.tongran.common.core.web.domain.AjaxResult;
|
||||
import com.tongran.common.core.web.page.PageDomain;
|
||||
import com.tongran.common.core.web.page.TableDataInfo;
|
||||
import com.tongran.common.log.annotation.Log;
|
||||
import com.tongran.common.log.enums.BusinessType;
|
||||
import com.tongran.common.security.annotation.RequiresPermissions;
|
||||
import com.tongran.mtragent.domain.RmMtrPolicyConfig;
|
||||
import com.tongran.mtragent.service.IRmMtrPolicyConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* mtr探测策略配置Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-11-18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mtrPolicyConfig")
|
||||
public class RmMtrPolicyConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmMtrPolicyConfigService rmMtrPolicyConfigService;
|
||||
|
||||
/**
|
||||
* 查询mtr探测策略配置列表
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrPolicyConfig:list")
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody RmMtrPolicyConfig rmMtrPolicyConfig)
|
||||
{
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(rmMtrPolicyConfig.getPageNum());
|
||||
pageDomain.setPageSize(rmMtrPolicyConfig.getPageSize());
|
||||
startPage(pageDomain);
|
||||
List<RmMtrPolicyConfig> list = rmMtrPolicyConfigService.selectRmMtrPolicyConfigList(rmMtrPolicyConfig);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出mtr探测策略配置列表
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrPolicyConfig:export")
|
||||
@Log(title = "mtr探测策略配置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RmMtrPolicyConfig rmMtrPolicyConfig)
|
||||
{
|
||||
List<RmMtrPolicyConfig> list = rmMtrPolicyConfigService.selectRmMtrPolicyConfigList(rmMtrPolicyConfig);
|
||||
ExcelUtil<RmMtrPolicyConfig> util = new ExcelUtil<RmMtrPolicyConfig>(RmMtrPolicyConfig.class);
|
||||
util.showColumn(rmMtrPolicyConfig.getProperties());
|
||||
util.exportExcel(response, list, "mtr探测策略配置数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取mtr探测策略配置详细信息
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrPolicyConfig:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmMtrPolicyConfigService.selectRmMtrPolicyConfigById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增mtr探测策略配置
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrPolicyConfig:add")
|
||||
@Log(title = "mtr探测策略配置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmMtrPolicyConfig rmMtrPolicyConfig)
|
||||
{
|
||||
return toAjax(rmMtrPolicyConfigService.insertRmMtrPolicyConfig(rmMtrPolicyConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改mtr探测策略配置
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrPolicyConfig:edit")
|
||||
@Log(title = "mtr探测策略配置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmMtrPolicyConfig rmMtrPolicyConfig)
|
||||
{
|
||||
return toAjax(rmMtrPolicyConfigService.updateRmMtrPolicyConfig(rmMtrPolicyConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除mtr探测策略配置
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrPolicyConfig:remove")
|
||||
@Log(title = "mtr探测策略配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(rmMtrPolicyConfigService.deleteRmMtrPolicyConfigByIds(ids));
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
package com.tongran.mtragent.controller;
|
||||
|
||||
import com.tongran.common.core.utils.poi.ExcelUtil;
|
||||
import com.tongran.common.core.web.controller.BaseController;
|
||||
import com.tongran.common.core.web.domain.AjaxResult;
|
||||
import com.tongran.common.core.web.page.TableDataInfo;
|
||||
import com.tongran.common.log.annotation.Log;
|
||||
import com.tongran.common.log.enums.BusinessType;
|
||||
import com.tongran.common.security.annotation.RequiresPermissions;
|
||||
import com.tongran.mtragent.domain.RmMtrProbeResult;
|
||||
import com.tongran.mtragent.service.IRmMtrProbeResultService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 网络mtr探测结果Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-11-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mtrProbeResult")
|
||||
public class RmMtrProbeResultController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmMtrProbeResultService rmMtrProbeResultService;
|
||||
|
||||
/**
|
||||
* 查询网络mtr探测结果列表
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrProbeResult:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RmMtrProbeResult rmMtrProbeResult)
|
||||
{
|
||||
startPage();
|
||||
List<RmMtrProbeResult> list = rmMtrProbeResultService.selectRmMtrProbeResultList(rmMtrProbeResult);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出网络mtr探测结果列表
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrProbeResult:export")
|
||||
@Log(title = "网络mtr探测结果", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RmMtrProbeResult rmMtrProbeResult)
|
||||
{
|
||||
List<RmMtrProbeResult> list = rmMtrProbeResultService.selectRmMtrProbeResultList(rmMtrProbeResult);
|
||||
ExcelUtil<RmMtrProbeResult> util = new ExcelUtil<RmMtrProbeResult>(RmMtrProbeResult.class);
|
||||
util.exportExcel(response, list, "网络mtr探测结果数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取网络mtr探测结果详细信息
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrProbeResult:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmMtrProbeResultService.selectRmMtrProbeResultById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增网络mtr探测结果
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrProbeResult:add")
|
||||
@Log(title = "网络mtr探测结果", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmMtrProbeResult rmMtrProbeResult)
|
||||
{
|
||||
return toAjax(rmMtrProbeResultService.insertRmMtrProbeResult(rmMtrProbeResult));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改网络mtr探测结果
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrProbeResult:edit")
|
||||
@Log(title = "网络mtr探测结果", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmMtrProbeResult rmMtrProbeResult)
|
||||
{
|
||||
return toAjax(rmMtrProbeResultService.updateRmMtrProbeResult(rmMtrProbeResult));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除网络mtr探测结果
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrProbeResult:remove")
|
||||
@Log(title = "网络mtr探测结果", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(rmMtrProbeResultService.deleteRmMtrProbeResultByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看丢包率趋势
|
||||
*/
|
||||
@RequiresPermissions("mtragent:mtrProbeResult:list")
|
||||
@PostMapping("/getLossRateByMtrClientId")
|
||||
public AjaxResult getLossRateByMtrClientId(@RequestBody RmMtrProbeResult rmMtrProbeResult)
|
||||
{
|
||||
Map<String, Object> list = rmMtrProbeResultService.getLossRateByMtrClientId(rmMtrProbeResult);
|
||||
return success(list);
|
||||
}
|
||||
}
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
package com.tongran.mtragent.controller;
|
||||
|
||||
|
||||
import com.tongran.common.security.annotation.InnerAuth;
|
||||
import com.tongran.mtragent.producer.MessageProducer;
|
||||
import org.apache.rocketmq.client.producer.SendResult;
|
||||
import org.apache.rocketmq.common.message.Message;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 消息测试类Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/rocketMessage")
|
||||
public class RocketMqController {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发送同步消息
|
||||
*/
|
||||
@PostMapping("/sendSynchronizeMessage")
|
||||
private Map sendSynchronizeMessage(){
|
||||
MessageProducer messageProducer = new MessageProducer();
|
||||
//调用MessageProducer配置好的消息方法
|
||||
SendResult sendResult = messageProducer.sendSynchronizeMessage("order-message","order_message_tag","title","content");
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
result.put("data",sendResult);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发送单向消息
|
||||
*/
|
||||
@PostMapping("/sendOnewayMessage")
|
||||
private Map sendOnewayMessage(@RequestParam("topic") String topic,@RequestParam("tag") String tag,@RequestParam("key") String key,@RequestParam("value") String value){
|
||||
MessageProducer messageProducer = new MessageProducer();
|
||||
//调用MessageProducer配置好的消息方法 topic需要你根据你们业务定制相应的
|
||||
messageProducer.sendOnewayMessage("order-message","order_timeout_tag","title","content");
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
result.put("msg","发送成功");
|
||||
result.put("code",200);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量发送消息
|
||||
*/
|
||||
@PostMapping("/sendBatchMessage")
|
||||
private Map sendBatchMessage(){
|
||||
// 根据实际需求创建消息列表并返回
|
||||
List<Message> messages = new ArrayList<>();
|
||||
// 添加消息到列表
|
||||
messages.add(new Message("order-message", "order_timeout_tag", "Message 1".getBytes()));
|
||||
messages.add(new Message("order-message", "order_timeout_tag", "Message 2".getBytes()));
|
||||
messages.add(new Message("order-message", "order_timeout_tag", "Message 3".getBytes()));
|
||||
MessageProducer messageProducer = new MessageProducer();
|
||||
//调用MessageProducer配置好的消息方法 topic需要你根据你们业务定制相应的
|
||||
SendResult sendResult = messageProducer.sendBatchMessage(messages);
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
result.put("data",sendResult);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送事物消息
|
||||
*/
|
||||
@PostMapping("/sendThingMessage")
|
||||
private Map sendThingMessage(@RequestParam("topic") String topic,@RequestParam("tag") String tag,@RequestParam("key") String key,@RequestParam("value") String value){
|
||||
MessageProducer messageProducer = new MessageProducer();
|
||||
//调用MessageProducer配置好的消息方法 topic需要你根据你们业务定制相应的
|
||||
SendResult sendResult = messageProducer.sendThingMessage("order-message","order_timeout_tag","title","content");
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
result.put("data",sendResult);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送有序的消息
|
||||
*/
|
||||
@PostMapping("/sendOrderlyMessage")
|
||||
private Map sendOrderlyMessage(){
|
||||
// 根据实际需求创建消息列表并返回
|
||||
List<Message> messages = new ArrayList<>();
|
||||
// 添加消息到列表
|
||||
messages.add(new Message("order-message", "order_timeout_tag", "Message 1".getBytes()));
|
||||
messages.add(new Message("order-message", "order_timeout_tag", "Message 2".getBytes()));
|
||||
messages.add(new Message("order-message", "order_timeout_tag", "Message 3".getBytes()));
|
||||
Integer messageQueueNumber = 3;
|
||||
MessageProducer messageProducer = new MessageProducer();
|
||||
//调用MessageProducer配置好的消息方法 topic需要你根据你们业务定制相应的
|
||||
SendResult sendResult = messageProducer.sendOrderlyMessage(messages,messageQueueNumber);
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
result.put("data",sendResult);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送延迟消息
|
||||
*/
|
||||
@PostMapping("/sendDelayMessage")
|
||||
private Map sendDelayMessage(@RequestParam("topic") String topic,@RequestParam("tag") String tag,@RequestParam("key") String key,@RequestParam("value") String value){
|
||||
MessageProducer messageProducer = new MessageProducer();
|
||||
//调用MessageProducer配置好的消息方法 topic需要你根据你们业务定制相应的
|
||||
SendResult sendResult = messageProducer.sendDelayMessage("order-message","order_timeout_tag","title","content",4);
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
result.put("data",sendResult);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送异步的消息
|
||||
*/
|
||||
@InnerAuth
|
||||
@PostMapping("/sendAsyncProducerMessage")
|
||||
private Map sendAsyncProducerMessage(@RequestParam("topic") String topic,@RequestParam("tag") String tag,@RequestParam("key") String key,@RequestParam("value") String value){
|
||||
MessageProducer messageProducer = new MessageProducer();
|
||||
//调用MessageProducer配置好的消息方法 topic需要你根据你们业务定制相应的
|
||||
SendResult sendResult = messageProducer.sendAsyncProducerMessage(topic,tag,key,value);
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
result.put("data",sendResult);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user