Esper Reference
Total Page:16
File Type:pdf, Size:1020Kb
Esper Reference Version 5.2.0 by Esper Team and EsperTech Inc. [http://esper.codehaus.org] Copyright 2006 - 2015 by EsperTech Inc. Preface ........................................................................................................................... xxi 1. Technology Overview .................................................................................................. 1 1.1. Introduction to CEP and event series analysis ...................................................... 1 1.2. CEP and relational databases ............................................................................. 1 1.3. The Esper engine for CEP .................................................................................. 2 1.4. Required 3rd Party Libraries ................................................................................ 2 2. Event Representations ................................................................................................ 3 2.1. Event Underlying Java Objects ............................................................................ 3 2.2. Event Properties ................................................................................................. 4 2.2.1. Escape Characters ................................................................................... 5 2.2.2. Expression as Key or Index Value ............................................................ 6 2.3. Dynamic Event Properties ................................................................................... 7 2.4. Fragment and Fragment Type ............................................................................. 9 2.5. Plain-Old Java Object Events .............................................................................. 9 2.5.1. Java Object Event Properties .................................................................. 10 2.5.2. Property Names ..................................................................................... 11 2.5.3. Parameterized Types .............................................................................. 12 2.5.4. Setter Methods for Indexed and Mapped Properties .................................. 12 2.5.5. Known Limitations .................................................................................. 13 2.6. java.util.Map Events .......................................................................................... 13 2.6.1. Overview ............................................................................................... 13 2.6.2. Map Properties ...................................................................................... 14 2.6.3. Map Supertypes ..................................................................................... 15 2.6.4. Advanced Map Property Types ............................................................... 16 2.7. Object-array (Object[]) Events ............................................................................ 18 2.7.1. Overview ............................................................................................... 18 2.7.2. Object-Array Properties .......................................................................... 19 2.7.3. Object-Array Supertype .......................................................................... 20 2.7.4. Advanced Object-Array Property Types ................................................... 21 2.8. org.w3c.dom.Node XML Events ......................................................................... 23 2.8.1. Schema-Provided XML Events ................................................................ 25 2.8.2. No-Schema-Provided XML Events ........................................................... 30 2.8.3. Explicitly-Configured Properties ............................................................... 30 2.9. Additional Event Representations ....................................................................... 32 2.10. Updating, Merging and Versioning Events ........................................................ 33 2.11. Coarse-Grained Events ................................................................................... 33 2.12. Event Objects Instantiated and Populated by Insert Into ..................................... 34 2.13. Comparing Event Representations ................................................................... 35 3. Processing Model ...................................................................................................... 37 3.1. Introduction ....................................................................................................... 37 3.2. Insert Stream .................................................................................................... 37 3.3. Insert and Remove Stream ................................................................................ 38 3.4. Filters and Where-clauses ................................................................................. 40 3.5. Time Windows .................................................................................................. 42 iii Esper Reference 3.5.1. Time Window ......................................................................................... 42 3.5.2. Time Batch ............................................................................................ 43 3.6. Batch Windows ................................................................................................. 44 3.7. Aggregation and Grouping ................................................................................. 45 3.7.1. Insert and Remove Stream ..................................................................... 45 3.7.2. Output for Aggregation and Group-By ...................................................... 46 3.8. Event Visibility and Current Time ....................................................................... 48 4. Context and Context Partitions ................................................................................. 49 4.1. Introduction ....................................................................................................... 49 4.2. Context Declaration ........................................................................................... 50 4.2.1. Context-Provided Properties ................................................................... 51 4.2.2. Keyed Segmented Context ..................................................................... 51 4.2.3. Hash Segmented Context ....................................................................... 55 4.2.4. Category Segmented Context ................................................................. 59 4.2.5. Non-Overlapping Context ........................................................................ 60 4.2.6. Overlapping Context ............................................................................... 63 4.2.7. Context Conditions ................................................................................. 66 4.3. Context Nesting ................................................................................................ 69 4.3.1. Built-In Nested Context Properties ........................................................... 70 4.4. Partitioning Without Context Declaration ............................................................. 71 4.5. Output When Context Partition Ends .................................................................. 72 4.6. Context and Named Window ............................................................................. 74 4.7. Context and Tables ........................................................................................... 75 4.8. Context and Variables ....................................................................................... 76 4.9. Operations on Specific Context Partitions ........................................................... 77 5. EPL Reference: Clauses ............................................................................................ 79 5.1. EPL Introduction ............................................................................................... 79 5.2. EPL Syntax ...................................................................................................... 80 5.2.1. Specifying Time Periods ......................................................................... 81 5.2.2. Using Comments .................................................................................... 82 5.2.3. Reserved Keywords ............................................................................... 82 5.2.4. Escaping Strings .................................................................................... 83 5.2.5. Data Types ............................................................................................ 84 5.2.6. Using Constants and Enum Types .......................................................... 86 5.2.7. Annotation ............................................................................................. 87 5.2.8. Expression Alias .................................................................................... 93 5.2.9. Expression Declaration ........................................................................... 94 5.2.10. Script Declaration ................................................................................. 96 5.2.11. Referring to a Context .......................................................................... 96 5.3. Choosing Event Properties And Events: the Select Clause .................................. 97 5.3.1. Choosing all event