ToolsController.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package com.fdkankan.manage.controller;
  2. import com.dtflys.forest.annotation.Post;
  3. import com.fdkankan.manage.common.ResultData;
  4. import com.fdkankan.manage.service.IMqBackupService;
  5. import com.fdkankan.manage.service.IToolsApiService;
  6. import org.springframework.amqp.rabbit.core.RabbitTemplate;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.web.bind.annotation.PostMapping;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RequestParam;
  11. import org.springframework.web.bind.annotation.RestController;
  12. import java.io.UnsupportedEncodingException;
  13. /**
  14. * 工具接口
  15. */
  16. @RestController
  17. @RequestMapping("/service/manage/tools")
  18. public class ToolsController {
  19. @Autowired
  20. private IMqBackupService mqBackupService;
  21. /**
  22. * 将指定队列的消息出队
  23. * @param queue 队列名称
  24. * @param needRequeue 是否需要从新入队(0-否,1-是),如果选择了是,则需要调用入队接口从新将消息入队
  25. * @return
  26. * @throws UnsupportedEncodingException
  27. */
  28. @PostMapping("/getRabbitMqMsg")
  29. public ResultData getRabbitMqMsg(
  30. @RequestParam(value = "queue") String queue,
  31. @RequestParam(value = "needRequeue") Integer needRequeue) throws UnsupportedEncodingException {
  32. return mqBackupService.getRabbitMqMsg(queue, needRequeue);
  33. }
  34. /**
  35. * 将指定队列的消息从新入队
  36. * @param queue 队列名称
  37. * @return
  38. * @throws UnsupportedEncodingException
  39. */
  40. @PostMapping("/rabbitmqRequeue")
  41. public ResultData rabbitmqRequeue(
  42. @RequestParam(value = "queue") String queue) throws UnsupportedEncodingException {
  43. return mqBackupService.rabbitmqRequeue(queue);
  44. }
  45. }