|
|
@@ -0,0 +1,23 @@
|
|
|
+package com.izouma.nineth.web;
|
|
|
+
|
|
|
+import com.izouma.nineth.event.MyMqEvent;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/testmq")
|
|
|
+@AllArgsConstructor
|
|
|
+public class RocketMqController {
|
|
|
+
|
|
|
+ private RocketMQTemplate rocketMQTemplate;
|
|
|
+
|
|
|
+ @GetMapping("/send")
|
|
|
+ public String send(String data) {
|
|
|
+ rocketMQTemplate.syncSend("test-mq-topic", new MyMqEvent(data));
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+
|
|
|
+}
|