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

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.

主站蜘蛛池模板: 绥滨县| 淳化县| 武鸣县| 莎车县| 恩平市| 蓬溪县| 固始县| 灯塔市| 丽水市| 万州区| 西和县| 永靖县| 梨树县| 社旗县| 根河市| 河北省| 安塞县| 建阳市| 体育| 望城县| 天门市| 彰化县| 鄂州市| 勐海县| 柯坪县| 江都市| 庆阳市| 阿克| 图片| 玉田县| 衡南县| 赣州市| 呼玛县| 峨眉山市| 巧家县| 潮安县| 任丘市| 东乌珠穆沁旗| 合江县| 北碚区| 大港区|