package com.yfd.platform.component.nettyclient;

import java.util.function.Consumer;

public class Event {
    // 事件的唯一 ID
    private String eventId;
    // 事件触发后的回调逻辑
    private Consumer<Object> callback;

    public Event(String eventId, Consumer<Object> callback) {
        this.eventId = eventId;
        this.callback = callback;
    }

    public String getEventId() {
        return eventId;
    }

    public void trigger(Object data) {
        if (callback != null) {
            // 触发事件
            callback.accept(data);
        }
    }
}
