package com.fjhx.rocketmq.producer; import com.fjhx.rocketmq.Message; import com.fjhx.rocketmq.service.RocketMqService; import org.springblade.core.tool.api.R; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * @author caozhoujun * @version 1.2 * @date 2020/5/19 */ @RestController @RequestMapping("/rocketmq") public class ProducerController { @Autowired private RocketMqService rocketMqService; @PostMapping("/senMsg") public R add(@RequestBody Message message){ rocketMqService.send(message); return R.success(); } }