package com.elab.core.async.pruducer;

import com.elab.core.async.RealTaskExecutor;
import com.elab.core.async.SchedulingTaskExecutor;
import com.elab.core.async.model.TaskStoreData;

import java.util.List;
import java.util.Map;
import java.util.function.Function;

/**
 * 消息生产者
 *
 * @author : liukx
 * @date : 2020/8/7 - 10:59
 */
public interface ITaskProducer {
    /**
     * 添加异步消息
     *
     * @param taskExecutor
     */
    public boolean sendRealTimeQueue(RealTaskExecutor taskExecutor);

    /**
     * 发送异步实时消息
     *
     * @param taskExecutor
     * @param taskStoreData
     */
    public boolean sendRealTimeQueue(RealTaskExecutor taskExecutor, TaskStoreData taskStoreData);

    /**
     * 发送异步调度消息
     *
     * @param schedulingTaskExecutor
     */
    public boolean sendSchedulingList(SchedulingTaskExecutor schedulingTaskExecutor);

    /**
     * 聚合运算
     * @param calculateList
     * @param function
     * @return
     */
    public Map<String, Object> reduce(List<?> calculateList, Function<List<?>, Map<String, Object>> function);
}
