Esper Reference
Total Page:16
File Type:pdf, Size:1020Kb
Esper Reference Version 8.3.0 by EsperTech Inc. [http://www.espertech.com] Copyright 2006 - 2019 by EsperTech Inc. Preface ......................................................................................................................... xxvii 1. Getting Started ............................................................................................................ 1 1.1. Introduction to Complex Event Processing ........................................................... 1 1.2. Introduction to the Architecture ............................................................................ 1 1.3. Introduction to EPL ............................................................................................. 2 1.4. Compiler Getting-Started ..................................................................................... 3 1.4.1. Compiler - Step One: Setting up the Compiler Classpath ............................ 3 1.4.2. Compiler - Step Two: Provide Information on Input Events .......................... 3 1.4.3. Compiler - Step Three: Compiling EPL ...................................................... 4 1.5. Runtime Getting-Started ...................................................................................... 5 1.5.1. Runtime - Step One: Setting up the Runtime Classpath .............................. 5 1.5.2. Runtime - Step Two: Obtain Runtime ........................................................ 6 1.5.3. Runtime - Step Three: Deploy EPL Compiled Module and Attach a Callback .......................................................................................................................... 6 1.5.4. Runtime - Step Four: Send Events ............................................................ 7 1.6. Required 3rd Party Libraries ................................................................................ 8 1.6.1. Common Required 3rd Party Libraries ....................................................... 8 1.6.2. Compiler - Required 3rd Party Libraries ..................................................... 8 1.6.3. Runtime - Required 3rd Party Libraries ...................................................... 8 2. Basic Concepts ........................................................................................................... 9 2.1. Introduction ........................................................................................................ 9 2.2. Basic Select ..................................................................................................... 10 2.3. Basic Aggregation ............................................................................................. 11 2.4. Basic Filter ....................................................................................................... 12 2.5. Basic Filter and Aggregation .............................................................................. 13 2.6. Basic Data Window ........................................................................................... 14 2.7. Basic Data Window and Aggregation ................................................................. 15 2.8. Basic Filter, Data Window and Aggregation ........................................................ 17 2.9. Basic Where-Clause ......................................................................................... 17 2.10. Basic Time Window and Aggregation ............................................................... 19 2.11. Basic Partitioned Statement ............................................................................. 20 2.12. Basic Output-Rate-Limited Statement ............................................................... 21 2.13. Basic Partitioned and Output-Rate-Limited Statement ........................................ 22 2.14. Basic Named Windows and Tables .................................................................. 23 2.14.1. Named Windows .................................................................................. 23 2.14.2. Tables ................................................................................................. 25 2.15. Basic Aggregated Statement Types ................................................................. 27 2.15.1. Un-Aggregated and Un-Grouped ........................................................... 27 2.15.2. Fully Aggregated and Un-Grouped ........................................................ 27 2.15.3. Aggregated and Un-Grouped ................................................................ 28 2.15.4. Fully Aggregated and Grouped .............................................................. 28 2.15.5. Aggregated and Grouped ...................................................................... 28 2.16. Basic Match-Recognize Patterns ...................................................................... 29 2.17. Basic EPL Patterns ......................................................................................... 29 iii Esper Reference 2.18. Basic Indexes ................................................................................................. 30 2.18.1. Index Kinds .......................................................................................... 30 2.18.2. Filter Indexes ....................................................................................... 31 2.18.3. Event Indexes ...................................................................................... 35 2.19. Basic Null ....................................................................................................... 35 3. Event Representations ............................................................................................... 37 3.1. Event Underlying Java Objects .......................................................................... 37 3.2. Event Properties ............................................................................................... 38 3.2.1. Escape Characters ................................................................................. 39 3.2.2. Expression as Key or Index Value ........................................................... 40 3.3. Dynamic Event Properties ................................................................................. 41 3.4. Fragment and Fragment Type ........................................................................... 43 3.5. Comparing Event Representations ..................................................................... 43 3.5.1. Incoming Events .................................................................................... 44 3.5.2. Outgoing Events .................................................................................... 45 3.5.3. Schema ................................................................................................. 45 3.5.4. Side-by-Side .......................................................................................... 46 3.6. Support for Generic Tuples ............................................................................... 47 3.7. Updating, Merging and Versioning Events .......................................................... 49 3.8. Coarse-Grained Events ..................................................................................... 49 3.9. Event Objects Instantiated and Populated by Insert Into ...................................... 49 3.10. Event Type Uniqueness .................................................................................. 51 4. Context and Context Partitions ................................................................................. 53 4.1. Introduction ....................................................................................................... 53 4.2. Context Declaration ........................................................................................... 55 4.2.1. Context-Provided Properties ................................................................... 55 4.2.2. Keyed Segmented Context ..................................................................... 56 4.2.3. Hash Segmented Context ....................................................................... 63 4.2.4. Category Segmented Context ................................................................. 66 4.2.5. Non-Overlapping Context ........................................................................ 68 4.2.6. Overlapping Context ............................................................................... 70 4.2.7. Context Conditions ................................................................................. 74 4.3. Context Nesting ................................................................................................ 78 4.3.1. Nested Context Sample Walk-Through .................................................... 79 4.3.2. Built-In Nested Context Properties ........................................................... 81 4.4. Partitioning Without Context Declaration ............................................................. 82 4.5. Output When a Context Partition Ends or Terminates .......................................... 82 4.6. Context and Named Window ............................................................................. 84 4.7. Context and Tables ........................................................................................... 86 4.8. Context and Variables ....................................................................................... 87 4.9. Operations on Specific Context Partitions ........................................................... 87 5. EPL