Programmers Guide Sybase Event Stream Processor 5.1 SP01 DOCUMENT ID: DC01612-01-0511-01 LAST REVISED: November 2012 Copyright © 2012 by Sybase, Inc
Total Page:16
File Type:pdf, Size:1020Kb
Programmers Guide Sybase Event Stream Processor 5.1 SP01 DOCUMENT ID: DC01612-01-0511-01 LAST REVISED: November 2012 Copyright © 2012 by Sybase, Inc. All rights reserved. This publication pertains to Sybase software and to any subsequent release until otherwise indicated in new editions or technical notes. Information in this document is subject to change without notice. The software described herein is furnished under a license agreement, and it may be used or copied only in accordance with the terms of that agreement. Upgrades are provided only at regularly scheduled software release dates. No part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic, mechanical, manual, optical, or otherwise, without the prior written permission of Sybase, Inc. Sybase trademarks can be viewed at the Sybase trademarks page at http://www.sybase.com/detail?id=1011207. Sybase and the marks listed are trademarks of Sybase, Inc. ® indicates registration in the United States of America. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. Java and all Java-based marks are trademarks or registered trademarks of Oracle and/or its affiliates in the U.S. and other countries. Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. All other company and product names mentioned may be trademarks of the respective companies with which they are associated. Use, duplication, or disclosure by the government is subject to the restrictions set forth in subparagraph (c)(1)(ii) of DFARS 52.227-7013 for the DOD and as set forth in FAR 52.227-19(a)-(d) for civilian agencies. Sybase, Inc., One Sybase Drive, Dublin, CA 94568. Contents CHAPTER 1: Introduction ...............................................1 Data-Flow Programming .......................................................1 Continuous Computation Language ....................................2 SPLASH ..................................................................................3 Authoring Methods ................................................................3 CHAPTER 2: CCL Project Basics ...................................5 Events .....................................................................................5 Operation Codes ....................................................................5 Streams ...................................................................................6 Windows .................................................................................7 Retention ........................................................................7 Named Windows ...........................................................10 Unnamed Windows .......................................................11 Delta Streams .......................................................................12 Comparing Streams, Windows, and Delta Streams .........12 Input/Output/Local ...............................................................13 Implicit Columns ..................................................................15 Schemas ...............................................................................15 Stores ....................................................................................16 CCL Continuous Queries ....................................................17 Adapters ...............................................................................18 Order of Elements ................................................................19 CHAPTER 3: Developing a Project in CCL ..................21 CHAPTER 4: CCL Language Components .................23 Datatypes ..............................................................................23 Programmers Guide iii Contents Intervals ........................................................................26 Operators ..............................................................................27 Expressions .........................................................................31 CCL Comments ....................................................................32 Case-Sensitivity ...................................................................33 CHAPTER 5: CCL Query Construction .......................35 Filtering .................................................................................35 Splitting Up Incoming Data .................................................36 Unions ...................................................................................37 Example: Merging Data from Streams or Windows ......38 Joins .....................................................................................38 Key Field Rules .............................................................40 Join Examples: ANSI Syntax ........................................41 Join Example: Comma-Separated Syntax ....................43 Pattern Matching ..................................................................44 Aggregation ..........................................................................44 CHAPTER 6: Advanced CCL Programming Techniques .................................................................47 Declare Blocks .....................................................................47 Typedefs .......................................................................48 Parameters ...................................................................48 Variables .......................................................................49 Declaring Project Variables, Parameters, Datatypes, and Functions ...........................................................51 Flex Operators .....................................................................52 Modularity .............................................................................52 Module Creation and Usage .........................................53 Example: Creating and Using Modules ........................53 Example: Parameters in Modules .................................54 Data Recovery ......................................................................56 Log Store Optimization Techniques ..............................57 Error Streams .......................................................................57 iv Sybase Event Stream Processor Contents Monitoring Streams for Errors .......................................59 CHAPTER 7: Writing SPLASH Routines .....................61 Internal Pulsing ....................................................................61 Order Book ...........................................................................62 CHAPTER 8: Integrating SPLASH into CCL ................65 Access to the Event .............................................................65 Access to Input Streams .....................................................65 Output Statement .................................................................67 Notes on Transactions ........................................................67 CHAPTER 9: Using SPLASH in Projects .....................69 CHAPTER 10: PowerDesigner for Event Stream Processor ...................................................................73 Getting Started .....................................................................73 Data Modeling Scenarios ............................................. 73 Sample PowerDesigner Project ....................................74 Opening the Sample Project ................................74 Learning More About PowerDesigner ...........................74 Data Model ............................................................................74 ESP Schema Logical Data Model .................................75 Finding an Object in a Diagram ....................................75 Data Model Tables ........................................................75 Extensions ....................................................................77 Category Set ........................................................78 Schema Definitions ..............................................78 Impact and Lineage Analysis ...............................79 Extended Model Setup ........................................................79 Extending an Existing Model ........................................ 79 Setting Up the Model Category Set File .......................80 Programmers Guide v Contents Merging ESP Categories .....................................80 Changing the Default Category ...........................81 Setting Datatypes for an ESP Schema .........................81 ESP Schema Model Development ......................................82 Exploring the Sample Model .........................................82 The Sample Model ........................................................83 Creating an ESP Schema Model ..................................85 Creating a Model Using Categories .....................85 Creating a Logical Data Model ............................85 Adding Schema Definition ...................................86 Defining Schema Properties ................................87 Validating a Model ........................................................90 PowerDesigner Validity Checks ...........................91 Custom Checks for ESP Schema Extensions .....91 Importing a CCL File .....................................................91 Exporting a CCL File ....................................................92 Model Generation ................................................................92