package com.primeton.dgs.kernel.core.message;
import java.util.HashMap;
import java.util.Map;
/**
*
*
* Created by zhaopx.
* User: zhaopx
* Date: 2019/11/11
* Time: 16:02
*
*
*
* @author zhaopx
*/
public class Event {
/**
* 包含的消息 头
*/
private final Map header = new HashMap<>(4);
/**
* 要发送的通道
*/
private final String topic;
/**
* 消息体
*/
private final T payload;
public Event(String topic, T payload) {
this.topic = topic;
this.payload = payload;
}
public void addHeader(String key, Object value) {
header.put(key, value);
}
public Map getHeader() {
return header;
}
public String getTopic() {
return topic;
}
public T getPayload() {
return payload;
}
}