package com.mortals.xhx.queue;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 默认消息
 *
 * @author: zxfei
 * @date: 2021/11/22 10:59
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DefaultTbQueueMsg implements TbQueueMsg {
    /**
     * key 唯一标识
     */
    private  String key;
    /**
     * 数据载体
     */
    private  String data;

    /**
     * 消息头信息
     */
    private  TbQueueMsgHeaders headers;

    public DefaultTbQueueMsg(TbQueueMsg msg) {
        this.key = msg.getKey();
        this.data = msg.getData();
        TbQueueMsgHeaders headers = new DefaultTbQueueMsgHeaders();

        msg.getHeaders().getData().entrySet().stream().forEach(item->
            headers.put(item.getKey(),item.getValue()));

        this.headers = headers;
    }

    public static void main(String[] args) {


    }

}
