package com.iplatform.rectext.scheduler; import com.iplatform.gather.GatherScheduler; import com.walker.store.AbstractStore; import com.walker.store.support.EmptyDatabaseStore; import com.walker.store.task.GatherTask; /** * 持续写入课程文本描述到相似数据库中,在数据库中定义任务时间周期。 *
* 1)该任务不会停止,每间隔2小时执行一次; * 2)增量拉取数据,数据先组织好写入中间表,然后调用sdk写入milvus **/ public class WriteCourseToMilvus extends GatherScheduler { private GatherTask gatherTask; public WriteCourseToMilvus(int id, String name){ super(id, name, new EmptyDatabaseStore()); } @Override protected GatherTask providerTask(AbstractStore store) { return null; } @Override protected void terminateGatherScheduler(int schedulerId) { } @Override protected Object onProcess(Object[] inputParams) throws Exception { if(this.gatherTask == null){ this.gatherTask = this.providerTask(this.getStore()); if(this.gatherTask == null){ throw new IllegalArgumentException("未提供任务对象,调度无法执行:" + this.getName()); } } // srcName, createTableSQL, parameter, params[] return this.gatherTask.run((String)inputParams[0], (String)inputParams[1], inputParams[2], (Object[])inputParams[3]); } }