package cn.reghao.devops.web.ws.event;

import cn.reghao.jutil.jdk.event.message.Event;
import cn.reghao.jutil.jdk.event.handler.Handler;
import cn.reghao.devops.common.msg.event.EvtAgentHeartbeat;
import org.springframework.stereotype.Service;

/**
 * @author reghao
 * @date 2020-12-30 10:26:47
 */
@Service
public class EvtAgentHeartbeatHandler extends Handler {
    private final MachineEventService machineEventService;

    public EvtAgentHeartbeatHandler(MachineEventService machineEventService) {
        this.machineEventService = machineEventService;
    }

    @Override
    public void handle(Event evt) {
        EvtAgentHeartbeat machineStat = (EvtAgentHeartbeat) evt;
        machineEventService.heartbeat(machineStat);
    }
}
