Developer's Guide Sergey A
Total Page:16
File Type:pdf, Size:1020Kb
Complex Event Processing with Triceps CEP v1.0 Developer's Guide Sergey A. Babkin Complex Event Processing with Triceps CEP v1.0 : Developer's Guide Sergey A. Babkin Copyright © 2011, 2012 Sergey A. Babkin All rights reserved. This manual is a part of the Triceps project. It is covered by the same Triceps version of the LGPL v3 license as Triceps itself. The author can be contacted by e-mail at <[email protected]> or <[email protected]>. Many of the designations used by the manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this manual, and the author was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this manual, the author assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. Table of Contents 1. The field of CEP .................................................................................................................................. 1 1.1. What is the CEP? ....................................................................................................................... 1 1.2. The uses of CEP ........................................................................................................................ 2 1.3. Surveying the CEP langscape ....................................................................................................... 2 1.4. We're not in 1950s any more, or are we? ........................................................................................ 3 2. Enter Triceps ....................................................................................................................................... 7 2.1. What led to it ............................................................................................................................ 7 2.2. Hello, world! ............................................................................................................................. 8 3. Building Triceps ................................................................................................................................. 11 3.1. Downloading Triceps ................................................................................................................ 11 3.2. The reference environment ......................................................................................................... 11 3.3. The basic build ........................................................................................................................ 11 3.4. Building the documentation ........................................................................................................ 12 3.5. Running the examples and simple programs .................................................................................. 13 3.6. Installation of the Perl library ..................................................................................................... 14 3.7. Installation of the C++ library ..................................................................................................... 15 3.8. Disambiguation of the C++ library .............................................................................................. 16 3.9. Build configuration settings ........................................................................................................ 17 4. API Fundamentals ............................................................................................................................... 19 4.1. Languages and layers ................................................................................................................ 19 4.2. Errors, deaths and confessions .................................................................................................... 19 4.3. Memory management fundamentals ............................................................................................. 21 4.4. Triceps constants ...................................................................................................................... 22 4.5. Printing the object contents ........................................................................................................ 22 4.6. The Hungarian notation ............................................................................................................. 24 5. Rows ................................................................................................................................................ 25 5.1. Simple types ............................................................................................................................ 25 5.2. Row types ............................................................................................................................... 25 5.3. Row types equivalence .............................................................................................................. 27 5.4. Rows ...................................................................................................................................... 28 6. Labels and Row Operations .................................................................................................................. 31 6.1. Labels basics ........................................................................................................................... 31 6.2. Label construction .................................................................................................................... 32 6.3. Other label methods .................................................................................................................. 33 6.4. Row operations ........................................................................................................................ 34 6.5. Opcodes .................................................................................................................................. 36 7. Scheduling ......................................................................................................................................... 39 7.1. Overview of the scheduling ........................................................................................................ 39 7.2. No bundling ............................................................................................................................ 39 7.3. Basic scheduling in Triceps ........................................................................................................ 40 7.4. Loop scheduling ....................................................................................................................... 42 7.5. Execution unit .......................................................................................................................... 46 7.6. Error handling during the execution ............................................................................................. 50 7.7. The main loop ......................................................................................................................... 50 7.8. Main loop with a socket ............................................................................................................ 51 7.9. Example of a topological loop .................................................................................................... 56 7.10. Issues with the Triceps scheduling ............................................................................................. 59 7.11. Trays, or yes bundling ............................................................................................................. 60 7.12. Tracing the execution .............................................................................................................. 61 8. Memory Management .......................................................................................................................... 69 8.1. Reference cycles ....................................................................................................................... 69 8.2. Clearing of the labels ................................................................................................................ 70 8.3. The clearing labels .................................................................................................................... 71 iii 9. Tables ............................................................................................................................................... 73 9.1. Hello, tables! ........................................................................................................................... 73 9.2. Tables and labels ...................................................................................................................... 74 9.3. Basic iteration through the table .................................................................................................. 77 9.4. Deleting a row ......................................................................................................................... 77 9.5. A closer look at the RowHandles ................................................................................................ 78 9.6. A window is a FIFO ................................................................................................................. 80 9.7. Secondary indexes