admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package com.yeshi.fanli.util.rocketmq;
 
import com.aliyun.openservices.ons.api.Message;
import com.google.gson.Gson;
import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
 
public class MQMsgBodyFactory {
    
    public static Message create(MQTopicName topic,OrderTopicTagEnum tag,Object body){
        return new Message(topic.name(), tag.name(), new Gson().toJson(body).getBytes());
    }
    
    public static Message create(MQTopicName topic,UserTopicTagEnum tag,Object body){
        return new Message(topic.name(), tag.name(), new Gson().toJson(body).getBytes());
    }
 
}