12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- package com.primeton.dgs.kernel.core.message;
- import java.util.HashMap;
- import java.util.Map;
- /**
- * <pre>
- *
- * Created by zhaopx.
- * User: zhaopx
- * Date: 2019/11/11
- * Time: 16:02
- *
- * </pre>
- *
- * @author zhaopx
- */
- public class Event<T> {
- /**
- * 包含的消息 头
- */
- private final Map<String, Object> 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<String, Object> getHeader() {
- return header;
- }
- public String getTopic() {
- return topic;
- }
- public T getPayload() {
- return payload;
- }
- }
|