1
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package cn.van.business.mq;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -16,7 +17,10 @@ public class MessageProducerService {
|
||||
@Autowired
|
||||
private RocketMQTemplate rocketMQTemplate;
|
||||
|
||||
public void sendMessage(String topic, String message) {
|
||||
this.rocketMQTemplate.convertAndSend(topic, message);
|
||||
private static final String topic = "wx-message";
|
||||
|
||||
|
||||
public void sendMessage(JSONObject jsonObject) {
|
||||
this.rocketMQTemplate.convertAndSend(topic, jsonObject.toJSONString());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user