package com.mes.task.service;
|
|
import com.mes.task.entity.MultiDeviceTask;
|
import com.mes.task.entity.TaskStepDetail;
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
|
import java.util.List;
|
|
/**
|
* 任务状态通知服务
|
* 用于实时推送任务执行状态
|
*
|
* @author mes
|
* @since 2025-01-XX
|
*/
|
public interface TaskStatusNotificationService {
|
|
/**
|
* 创建SSE连接
|
*
|
* @param taskId 任务ID(可选,如果为null则监听所有任务)
|
* @return SSE发射器
|
*/
|
SseEmitter createConnection(String taskId);
|
|
/**
|
* 发送任务状态更新
|
*
|
* @param task 任务实体
|
*/
|
void notifyTaskStatus(MultiDeviceTask task);
|
|
/**
|
* 发送任务步骤更新
|
*
|
* @param taskId 任务ID
|
* @param step 步骤详情
|
*/
|
void notifyStepUpdate(String taskId, TaskStepDetail step);
|
|
/**
|
* 发送任务步骤列表更新
|
*
|
* @param taskId 任务ID
|
* @param steps 步骤列表
|
*/
|
void notifyStepsUpdate(String taskId, List<TaskStepDetail> steps);
|
|
/**
|
* 关闭指定任务的连接
|
*
|
* @param taskId 任务ID
|
*/
|
void closeConnections(String taskId);
|
|
/**
|
* 关闭所有连接
|
*/
|
void closeAllConnections();
|
}
|