ProducerController.java 829 B

123456789101112131415161718192021222324252627282930
  1. package com.fjhx.rocketmq.producer;
  2. import com.fjhx.rocketmq.Message;
  3. import com.fjhx.rocketmq.service.RocketMqService;
  4. import org.springblade.core.tool.api.R;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.web.bind.annotation.PostMapping;
  7. import org.springframework.web.bind.annotation.RequestBody;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.RestController;
  10. /**
  11. * @author caozhoujun
  12. * @version 1.2
  13. * @date 2020/5/19
  14. */
  15. @RestController
  16. @RequestMapping("/rocketmq")
  17. public class ProducerController {
  18. @Autowired
  19. private RocketMqService rocketMqService;
  20. @PostMapping("/senMsg")
  21. public R add(@RequestBody Message message){
  22. rocketMqService.send(message);
  23. return R.success();
  24. }
  25. }