|
@@ -0,0 +1,168 @@
|
|
|
+package com.qmth.teachcloud.common.bean.dto;
|
|
|
+
|
|
|
+import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
+import com.qmth.teachcloud.common.enums.MqTagEnum;
|
|
|
+
|
|
|
+import java.io.Serializable;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.UUID;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description: mq dto
|
|
|
+ * @Param:
|
|
|
+ * @return:
|
|
|
+ * @Author: wangliang
|
|
|
+ * @Date: 2020/7/1
|
|
|
+ */
|
|
|
+public class MqDto implements Serializable {
|
|
|
+ private static final long serialVersionUID = 1L;
|
|
|
+
|
|
|
+ private String id;//消息id
|
|
|
+ private String topic;//消息topic
|
|
|
+ private String tag;//消息tag
|
|
|
+ private Long timestamp;//时间戳
|
|
|
+ private Object body;//消息体
|
|
|
+ private MqTagEnum type;//消息类型
|
|
|
+ private String objId;//关联业务id
|
|
|
+ private String objName;//关联业务名称
|
|
|
+ private Integer ack;//ack
|
|
|
+ private Integer sequence;//序号
|
|
|
+ private Map<String, Object> properties;//扩展类型
|
|
|
+ private Integer reconsume = 3;//重试次数
|
|
|
+
|
|
|
+ public MqDto() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public MqDto(String topic, String tag, String objId, Long timestamp) {
|
|
|
+ this.topic = topic;
|
|
|
+ this.tag = tag;
|
|
|
+ this.body = tag;
|
|
|
+ this.type = MqTagEnum.valueOf(tag);
|
|
|
+ this.objId = objId;
|
|
|
+ this.timestamp = timestamp;
|
|
|
+ this.id = SystemConstant.getUuid();
|
|
|
+ }
|
|
|
+
|
|
|
+ public MqDto(String topic, Object body, String objId) {
|
|
|
+ this.topic = topic;
|
|
|
+ this.tag = topic;
|
|
|
+ this.body = body;
|
|
|
+ this.type = MqTagEnum.valueOf(MqTagEnum.convertToName(tag));
|
|
|
+ this.objId = objId;
|
|
|
+ this.timestamp = System.currentTimeMillis();
|
|
|
+ this.id = SystemConstant.getUuid();
|
|
|
+ }
|
|
|
+
|
|
|
+ public MqDto(String topic, String tag, Object body, MqTagEnum type, String objId, Map properties) {
|
|
|
+ this.topic = topic;
|
|
|
+ this.tag = tag;
|
|
|
+ this.body = body;
|
|
|
+ this.type = type;
|
|
|
+ this.objId = objId;
|
|
|
+ this.timestamp = System.currentTimeMillis();
|
|
|
+ this.id = SystemConstant.getUuid();
|
|
|
+ this.properties = properties;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Integer getReconsume() {
|
|
|
+ return reconsume;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setReconsume(Integer reconsume) {
|
|
|
+ this.reconsume = reconsume;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static long getSerialVersionUID() {
|
|
|
+ return serialVersionUID;
|
|
|
+ }
|
|
|
+
|
|
|
+ public MqTagEnum getType() {
|
|
|
+ return type;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setType(MqTagEnum type) {
|
|
|
+ this.type = type;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getId() {
|
|
|
+ return id;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setId(String id) {
|
|
|
+ this.id = id;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getTopic() {
|
|
|
+ return topic;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setTopic(String topic) {
|
|
|
+ this.topic = topic;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getTag() {
|
|
|
+ return tag;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setTag(String tag) {
|
|
|
+ this.tag = tag;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Long getTimestamp() {
|
|
|
+ return timestamp;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setTimestamp(Long timestamp) {
|
|
|
+ this.timestamp = timestamp;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Object getBody() {
|
|
|
+ return body;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setBody(Object body) {
|
|
|
+ this.body = body;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getObjId() {
|
|
|
+ return objId;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setObjId(String objId) {
|
|
|
+ this.objId = objId;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getObjName() {
|
|
|
+ return objName;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setObjName(String objName) {
|
|
|
+ this.objName = objName;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, Object> getProperties() {
|
|
|
+ return properties;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setProperties(Map<String, Object> properties) {
|
|
|
+ this.properties = properties;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Integer getAck() {
|
|
|
+ return ack;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setAck(Integer ack) {
|
|
|
+ this.ack = ack;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Integer getSequence() {
|
|
|
+ return sequence;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setSequence(Integer sequence) {
|
|
|
+ this.sequence = sequence;
|
|
|
+ }
|
|
|
+}
|