官术网_书友最值得收藏!

Apex DAG Java API

The low-level DAG API is defined by the Apex engine. Any application that runs on Apex, irrespective of the original specification format, will be translated into this API. It is sometimes also referred to as compositional, as it represents the logical DAG, which will be translated into a physical plan and mapped to the execution layer by the Apex runtime.

The following is the Word Count example application, briefly introduced in the Stream Processing section earlier written with the DAG API:

LineReader lineReader = dag.addOperator("input", new LineReader()); 
Parser parser = dag.addOperator("parser", new Parser()); 
UniqueCounter counter = dag.addOperator("counter", new UniqueCounter()); 
ConsoleOutputOperator cons = dag.addOperator("console", new 
ConsoleOutputOperator()); dag.addStream("lines", lineReader.output, parser.input); dag.addStream("words", parser.output, counter.data); dag.addStream("counts", counter.count, cons.input);

The developer implements a method that is provided with a DAG handle by the engine (in this case, dag) through which operators are added and then connected with streams.

As mentioned, the Apex library provides many prebuilt operators. Operators can also be custom and encapsulate use case specific logic, or they can come from a library of an organization to share reusable logic across applications.

The DAG API is referred to as low level because many aspects are explicit. The developer identifies the operators and is aware of the ports for stream connections. In the case of larger applications, the wiring code can become more challenging to navigate. At the same time, the DAG API offers the most flexibility to the developer and is often used in larger projects that typically involve significant operator development and customization and where the complexity of wiring the DAG is normally not a concern.

主站蜘蛛池模板: 镇安县| 天等县| 铁力市| 澄城县| 黑河市| 霍州市| 集贤县| 育儿| 遵化市| 秀山| 水富县| 芒康县| 长沙县| 明水县| 毕节市| 金华市| 高台县| 翁源县| 遵化市| 衡东县| 桐城市| 绥宁县| 南木林县| 垦利县| 治多县| 威宁| 巴青县| 南宫市| 沁阳市| 剑河县| 桓仁| 德化县| 自治县| 高淳县| 绍兴县| 永州市| 台山市| 高州市| 盐源县| 双流县| 儋州市|