package com.zd.laboratory.event;

import org.springframework.context.ApplicationEvent;
import org.springframework.messaging.Message;

/**
 * Controller
 *
 * @author cyl
 * @date 2021/10/14
 */
public abstract class LabMessageEvent<T> extends ApplicationEvent {

    private String msg;


    private T message;


    public LabMessageEvent(Object source) {
        super(source);
    }

    abstract public String topic();

    abstract public LabMessageEvent createNew();

    final public LabMessageEvent getNewLabMessageEvent(T message)
    {
        LabMessageEvent aNew = createNew();
        aNew.setMessage(message);
        return    aNew;

    }

    private LabMessageEvent<T> setMessage(T message)
    {
        this.message=message;
        return this;
    }

    public String getMsg() {
        return msg;
    }



    public T getMessage() {
        return message;
    }
}
