How to Configure an Oracle CQL Processor Table Source Using Oracle CEP IDE for Eclipse

10-10 Oracle Complex Event Processing Developers Guide For more information on creating event types, see: ■ Chapter 2.1.4, Creating Oracle CEP Event Types ■ Section 2.1.3, Event Type Data Types 10. Right-click the Oracle CQL processor node connected to the table in your EPN and select Go to Configuration Source. Table 10–3 SQL Column Types and Oracle CEP Type Equivalents SQL Type Oracle CEP Java Type com.bea.wlevs.ede.api.Type Description ARRAY [Ljava.lang.Object Array, of depth 1, of java.lang.Object. BIGINT java.math.BigInteger bigint An instance of java.math.BigInteger. BINARY byte[] Array, of depth 1, of byte. BIT java.lang.Boolean boolean An instance of java.lang.Boolean. BLOB byte[] Array, of depth 1, of byte. BOOLEAN java.lang.Boolean boolean An instance of java.lang.Boolean. CHAR java.lang.Character char An instance of java.lang.Character. CLOB byte[] Array, of depth 1, of byte. DATE java.sql.Date timestamp An instance of java.sql.Date. DECIMAL java.math.BigDecimal An instance of java.math.BigDecimal. BINARY_DOUBLE 1 or DOUBLE 2 1 Oracle SQL. 2 Non-Oracle SQL. java.lang.Double double An instance of java.lang.Double BINARY_FLOAT 1 or FLOAT 2 java.lang.Double float An instance of java.lang.Double INTEGER java.lang.Integer int An instance of java.lang.Integer. JAVA_OBJECT java.lang.Object object An instance of java.lang.Object. LONGNVARCHAR char[] char Array, of depth 1, of char. LONGVARBINARY byte[] Array, of depth 1, of byte. LONGVARCHAR char[] char Array, of depth 1, of char. NCHAR char[] char Array, of depth 1, of char. NCLOB byte[] Array, of depth 1, of byte. NUMERIC java.math.BigDecimal An instance of java.math.BigDecimal. NVARCHAR char[] char Array, of depth 1, of char. OTHER java.lang.Object object An instance of java.lang.Object. REAL java.lang.Float float An instance of java.lang.Float SMALLINT java.lang.Integer int An instance of java.lang.Integer. SQLXML xmltype xmltype For more information on processing XMLTYPE data in Oracle CQL, see SQLXML SQLX in the Oracle Complex Event Processing CQL Language Reference. TIME java.sql.Time An instance of java.sql.Time. TIMESTAMP java.sql.Timestamp timestamp An instance of java.sql.Timestamp. TINYINT java.lang.Integer int An instance of java.lang.Integer. VARBINARY byte[] Array, of depth 1, of byte. VARCHAR char[] char Array, of depth 1, of char. Configuring Oracle CQL Processors 10-11 Oracle CEP IDE for Eclipse opens the component configuration file for this Oracle CQL processor. 11. Edit the component configuration file to add Oracle CQL queries that use the table’s event-type as shown in Example 10–10 . Example 10–10 Oracle CQL Query Using Table Event Type StockEvent processor nameprocname rules query id=q1[CDATA[ SELECT ExchangeStream.symbol, ExchangeStream.price, Stock.exchange FROM ExchangeStream [Now], Stock WHERE ExchangeStream.symbol = Stock.symbol ]]query rules processor

10.4 Configuring an Oracle CQL Processor Cache Source

You can configure an Oracle CQL processor to access the Oracle CEP cache. For more information, see: ■ Section 12.1, Overview of Oracle CEP Cache Configuration ■ Section 12.9, Accessing a Cache From an Oracle CQL User-Defined Function ■ Section 12.5, Accessing a Cache From an Oracle CQL Statement

10.5 Example Oracle CQL Processor Configuration Files

This section provides example Oracle CQL processor configuration files, including: ■ Section 10.5.1, Oracle CQL Processor Component Configuration File ■ Section 10.5.2, Oracle CQL Processor EPN Assembly File

10.5.1 Oracle CQL Processor Component Configuration File

The following example shows a component configuration file for an Oracle CQL processor. ?xml version=1.0 encoding=UTF-8? n1:config xsi:schemaLocation=http:www.bea.comnswlevsconfigapplication wlevs_application_ config.xsd xmlns:n1=http:www.bea.comnswlevsconfigapplication xmlns:xsi=http:www.w3.org2001XMLSchema-instance processor nameprocname rules view id=lastEvents schema=cusip bid srcId bidQty ask askQty seq[CDATA[ select modprice from filteredStream[partition by srcId, cusip rows 1] Note: Because changes in the table source are not coordinated in time with stream data, you may only use a Now window. For more information, see S[Now] in the Oracle Complex Event Processing CQL Language Reference. 10-12 Oracle Complex Event Processing Developers Guide ]]view query id=q1[CDATA[ SELECT FROM lastEvents [Now] WHERE price 10000 ]]query rules processor n1:config In the example, the name element specifies that the processor for which the Oracle CQL rules are being configured is called proc. This in turn implies that the EPN assembly file that defines your application must include a corresponding wlevs:processor element with an id attribute value of proc to link these Oracle CQL rules with an actual proc processor instance see Section 10.5.2, Oracle CQL Processor EPN Assembly File . This Oracle CQL processor component configuration file also defines a view element to specify an Oracle CQL view statement the Oracle CQL equivalent of a subquery. The results of the view’s select are not output to a down-stream channel. Finally, this Oracle CQL processor component configuration file defines a query element to specify an Oracle CQL query statement. The query statement selects from the view. By default, the results of a query are output to a down-stream channel. You can control this behavior in the channel configuration using a selector element. For more information, see: ■ Section 9.2.1, How to Configure a System-Timestamped Channel Using Oracle CEP IDE for Eclipse ■ Section 9.2.2, How to Configure an Application-Timestamped Channel Using Oracle CEP IDE for Eclipse

10.5.2 Oracle CQL Processor EPN Assembly File

The following example shows an EPN assembly file for an Oracle CQL processor. ?xml version=1.0 encoding=UTF-8? beans xmlns=http:www.springframework.orgschemabeans xmlns:xsi=http:www.w3.org2001XMLSchema-instance xmlns:osgi=http:www.springframework.orgschemaosgi xmlns:wlevs=http:www.bea.comnswlevsspring xsi:schemaLocation= http:www.springframework.orgschemabeans http:www.springframework.orgschemabeansspring-beans.xsd http:www.springframework.orgschemaosgi http:www.springframework.orgschemaosgispring-osgi.xsd http:www.bea.comnswlevsspring http:www.bea.comnswlevsspringspring-wlevs-v11_1_1_3.xsd wlevs:event-type-repository wlevs:event-type type-name=ExchangeEvent wlevs:properties wlevs:property name=symbol type=[C length=16 wlevs:property name=price type=java.lang.Double wlevs:properties wlevs:event-type wlevs:event-type type-name=StockExchangeEvent wlevs:properties wlevs:property name=symbol type=[C length=16 wlevs:property name=price type=java.lang.Double wlevs:property name=exchange type=[C length=16 wlevs:properties wlevs:event-type Configuring Oracle CQL Processors 10-13 wlevs:event-type type-name=StockEvent wlevs:properties wlevs:property name=symbol type=[C length=16 wlevs:property name=exchange type=[C length=16 wlevs:properties wlevs:event-type wlevs:event-type-repository -- Assemble EPN event processing network -- wlevs:adapter id=adapter class=com.bea.wlevs.example.db.ExchangeAdapter wlevs:listener ref=ExchangeStream wlevs:adapter wlevs:channel id=ExchangeStream event-type=ExchangeEvent wlevs:listener ref=proc wlevs:channel wlevs:table id=Stock event-type=StockEvent data-source=StockDs wlevs:processor id=proc advertise=true wlevs:table-source ref=Stock wlevs:processor wlevs:channel id=OutputStream advertise=true event-type=StockExchangeEvent wlevs:listener ref=bean wlevs:source ref=proc wlevs:channel osgi:reference id=ds interface=com.bea.core.datasource.DataSourceService cardinality=0..1 -- Create business object -- bean id=bean class=com.bea.wlevs.example.db.OutputBean property name=dataSourceService ref=ds bean beans 10-14 Oracle Complex Event Processing Developers Guide