package com.mortals.xhx.queue;

import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.UUID;

/**
 * 默认消息
 *
 * @author: zxfei
 * @date: 2021/11/22 10:59
 */
@Data
@AllArgsConstructor
public class DefaultTbQueueMsg implements TbQueueMsg {
    private final UUID key;
    private final byte[] data;
    private final TbQueueMsgHeaders headers;

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


    }

}
