本文主要研究一下otter的NodeTask

NodeTask

otter/node/common/src/main/java/com/alibaba/otter/node/common/config/model/NodeTask.java

public class NodeTask implements Serializable {

    private static final long serialVersionUID = 5442938515474956890L;
    private Pipeline          pipeline;
    private List<StageType>   stage            = new ArrayList<StageType>(); // 任务类型
    private List<TaskEvent>   event            = new ArrayList<TaskEvent>(); // 任务事件,新增/修改
    private boolean           shutdown         = false;

    public boolean isShutdown() {
        return shutdown;
    }

    public void setShutdown(boolean shutdown) {
        this.shutdown = shutdown;
    }

    /**
     * 任务事件,新增/删除/修改
     */
    public static enum TaskEvent {
        CREATE, DELETE;

        public boolean isCreate() {
            return this.equals(TaskEvent.CREATE);
        }

        public boolean isDelete() {
            return this.equals(TaskEvent.DELETE);
        }

    }

    public Pipeline getPipeline() {
        return pipeline;
    }

    public void setPipeline(Pipeline pipeline) {
        this.pipeline = pipeline;
    }

    public List<StageType> getStage() {
        return stage;
    }

    public void setStage(List<StageType> stage) {
        this.stage = stage;
    }

    public List<TaskEvent> getEvent() {
        return event;
    }

    public void setEvent(List<TaskEvent> event) {
        this.event = event;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
    }

}
  • NodeTask定义了pipeline、stage、event属性

Pipeline

otter/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/pipeline/Pipeline.java

public class Pipeline implements Serializable {

    private static final long   serialVersionUID = 5055655233043393285L;
    private Long                id;
    private Long                channelId;                                 // 对应关联的channel唯一标示id
    private String              name;
    private String              description;                               // 描述信息
    private List<Node>          selectNodes;
    private List<Node>          extractNodes;
    private List<Node>          loadNodes;
    private List<DataMediaPair> pairs;
    private Date                gmtCreate;
    private Date                gmtModified;
    private PipelineParameter   parameters       = new PipelineParameter();

    //......

}
  • Pipeline定义了id、channelId、name、description、selectNodes、extractNodes、loadNodes、pairs、parameters等属性

StageType

otter/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/enums/StageType.java

public enum StageType {

    SELECT, EXTRACT, TRANSFORM, LOAD;

    public boolean isSelect() {
        return this.equals(StageType.SELECT);
    }

    public boolean isExtract() {
        return this.equals(StageType.EXTRACT);
    }

    /**
     * transform和load一定会同时出现
     */
    public boolean isTransform() {
        return this.equals(StageType.TRANSFORM);
    }

    /**
     * transform和load一定会同时出现
     */
    public boolean isLoad() {
        return this.equals(StageType.LOAD);
    }
}
  • StageType分SELECT, EXTRACT, TRANSFORM, LOAD这个类型

小结

NodeTask定义了pipeline、stage、event属性;Pipeline定义了id、channelId、name、description、selectNodes、extractNodes、loadNodes、pairs、parameters等属性;StageType分SELECT, EXTRACT, TRANSFORM, LOAD这个类型

doc


codecraft
11.9k 声望2k 粉丝

当一个代码的工匠回首往事时,不因虚度年华而悔恨,也不因碌碌无为而羞愧,这样,当他老的时候,可以很自豪告诉世人,我曾经将代码注入生命去打造互联网的浪潮之巅,那是个很疯狂的时代,我在一波波的浪潮上留下...


引用和评论

0 条评论