AsyncMessage.java
958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.diligrp.assistant.shared.domain;
import com.diligrp.assistant.shared.util.JsonUtils;
/**
* MQ异步消息模型
*/
public class AsyncMessage {
// 消息类型
private Integer type;
// 消息体
private String payload;
// 消息参数
private String params;
public static AsyncMessage of(Integer type, String payload, String params) {
AsyncMessage message = new AsyncMessage();
message.type = type;
message.payload = payload;
message.params = params;
return message;
}
public static AsyncMessage from(String message) {
return JsonUtils.fromJsonString(message, AsyncMessage.class);
}
public Integer getType() {
return type;
}
public String getPayload() {
return payload;
}
public String getParams() {
return params;
}
public String toString() {
return JsonUtils.toJsonString(this);
}
}