Authored by YOHO01\x.wang

增加消息源所处环境标识

package com.yoho.message.sdk.common.handler;
import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import com.yoho.message.sdk.common.model.MessageCenterCommonEvent;
import com.yoho.message.sdk.common.mq.MessageProducerTemplate;
... ... @@ -23,6 +21,9 @@ public class MessageCenterMqHandler {
@Resource(name = "messageProducerTemplate")
private MessageProducerTemplate messageProducerTemplate;
@Value("${cloud:unknown}")
private String cloud;
private static final String MessageCenterTopic = "message-center-topic";
public void sendMessageToMq(MessageCenterCommonEvent event) {
... ... @@ -43,6 +44,8 @@ public class MessageCenterMqHandler {
params = new JSONObject();
event.setParams(params);
}
event.setSource(cloud);
messageProducerTemplate.send(MessageCenterTopic, event);
}
... ...
... ... @@ -2,7 +2,6 @@ package com.yoho.message.sdk.common.model;
import java.io.Serializable;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
/**
... ... @@ -18,6 +17,7 @@ public class MessageCenterCommonEvent implements Serializable{
private String sendSceneKey;// 场景key
private List<String> uidList;// 发送的uidList
private JSONObject params;// 关键参数
private String source;
public MessageCenterCommonEvent(String sendScene, String sendSceneKey,List<String> uidList) {
this.sendScene = sendScene;
... ... @@ -52,7 +52,6 @@ public class MessageCenterCommonEvent implements Serializable{
this.sendSceneKey = sendSceneKey;
}
public JSONObject getParams() {
return params;
}
... ... @@ -68,4 +67,12 @@ public class MessageCenterCommonEvent implements Serializable{
public void setUidList(List<String> uidList) {
this.uidList = uidList;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
}
... ...