1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| package com.nwa.controller;
import com.nwa.aop.SysLog; import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/** * @Author Lucky友人a * @Date 2023/2/27 -13:02 */
@RestController @RequestMapping("/rocket/producer") public class RocketProducerHandler {
@Resource private RocketMQTemplate rocketMQTemplate; @SysLog(operationType = "用户操作",operationName = "发送,并展示",value = "200") @RequestMapping("/send") public String send(){
for(int i=0;i<10;i++){ rocketMQTemplate.convertAndSend("rocket-send1","rocket-testA-"+i); }
return "send ok"; } }
|