Getting Started Event Processing Oracle Stream Analytics
Getting Started Event Processing Oracle Stream Analytics
E98694-01
Copyright © 2007, 2018, Oracle and/or its affiliates. All rights reserved.
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify,
license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means.
Reverse engineering, disassembly, or decompilation of this software, unless required by law for
interoperability, is prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on
behalf of the U.S. Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software,
any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are
"commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-
specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the
programs, including any operating system, integrated software, any programs installed on the hardware,
and/or documentation, shall be subject to license terms and license restrictions applicable to the programs.
No other rights are granted to the U.S. Government.
This software or hardware is developed for general use in a variety of information management applications.
It is not developed or intended for use in any inherently dangerous applications, including applications that
may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you
shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its
safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this
software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of
their respective owners.
Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are
used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron,
the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro
Devices. UNIX is a registered trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content, products,
and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly
disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise
set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be
responsible for any loss, costs, or damages incurred due to your access to or use of third-party content,
products, or services, except as set forth in an applicable agreement between you and Oracle.
Contents
Preface
Audience vii
Documentation Accessibility vii
Related Documents vii
Conventions viii
iii
3 Oracle JDeveloper Procedures
3.1 Import an Eclipse Project into Oracle JDeveloper 3-1
3.2 Add a Library to a Project 3-5
3.3 Create an Application Library 3-6
3.4 Assembly and Configuration Files 3-7
3.4.1 Create an Assembly File 3-7
3.4.2 Create a Component Configuration File 3-8
3.4.3 Add Components to a Configuration File 3-8
3.4.4 Add Configuration Settings to a Component 3-8
3.5 Configure a Relation Channel 3-9
3.6 Configure an Application Time-Stamped Channel 3-10
3.7 Create and Register a JavaBean Event Type 3-10
3.8 Create and Register a Tuple Event Type 3-11
3.9 Create an Event Bean 3-12
3.10 Create a Spring Bean 3-13
3.11 Configure a Table Source 3-13
3.12 Configure a Table Sink 3-15
3.13 Use Oracle CQL Patterns 3-16
3.14 Configure an Oracle Coherence Caching System and Cache 3-19
3.15 Configure a Local Caching System and Cache 3-23
3.16 Debug Java Classes 3-25
3.16.1 Debug on a Local Oracle Stream Analytics Server 3-25
3.16.2 Remote Oracle Stream Analytics Server 3-27
3.16.3 Oracle WebLogic Server 3-27
3.17 Testing with the Event Inspector Service 3-28
3.18 Start and Stop Oracle JDeveloper and Servers 3-29
iv
4.13 Stop the Load Generator and the Server 4-17
v
7.6.4.2 Create the Moving Average Query 7-32
7.7 Oracle Spatial Example 7-64
7.7.1 Run the Oracle Spatial Example 7-65
7.7.2 Build and Deploy the Oracle Spatial Example 7-68
7.7.3 Description of the Ant Targets to Build the Oracle Spatial Example 7-69
7.7.4 Implementation of the Oracle Spatial Example 7-69
7.8 Foreign Exchange (FX) Example 7-70
7.8.1 Run the Foreign Exchange Example 7-71
7.8.2 Build and Deploy the Foreign Exchange Example from the Source
Directory 7-72
7.8.3 Description of the Ant Targets to Build FX 7-73
7.8.4 Implementation of the FX Example 7-73
7.9 Signal Generation Example 7-74
7.9.1 Run the Signal Generation Example 7-75
7.9.2 Build and Deploy the Signal Generation Example from the Source
Directory 7-77
7.9.3 Description of the Ant Targets to Build Signal Generation 7-77
7.9.4 Implementation of the Signal Generation Example 7-78
7.10 Event Record and Playback Example 7-78
7.10.1 Run the Event Record/Playback Example 7-79
7.10.2 Build and Deploy the Event Record/Playback Example 7-85
7.10.3 Description of the Ant Targets to Build the Record and Playback
Example 7-85
7.10.4 Implementation of the Record and Playback Example 7-86
vi
Preface
This document provides general background information and detailed code samples to
help you learn about Oracle Stream Analytics and the Oracle CQL.
Audience
This document is intended for users interested in learning about Oracle Stream
Analytics and Oracle CQL. Readers should be familiar with basic Java development.
Some knowledge of SQL would be helpful.
Documentation Accessibility
For information about Oracle's commitment to accessibility, visit the Oracle
Accessibility Program website at http://www.oracle.com/pls/topic/lookup?
ctx=acc&id=docacc.
Related Documents
For more information, see the following:
• Known Issues for Oracle SOA Products at: http://www.oracle.com//technetwork/
middleware/soasuite/documentation/soaknownissues122120-3111966.html.
• Administering Oracle Stream Analytics
• Developing Event Processing Applications for Oracle Stream Analytics
• Schema Reference for Oracle Stream Analytics
• Using Visualizer for Oracle Stream Analytics
• Customizing Event Processing for Oracle Stream Analytics
• Developing Applications with Oracle CQL Data Cartridges
• Oracle CQL Language Reference
• Java API Reference for Oracle Stream Analytics
• Using Oracle Stream Analytics
• Getting Started with Oracle Stream Analytics
vii
Preface
Conventions
The following text conventions are used in this document:
Convention Meaning
boldface Boldface type indicates graphical user interface elements associated
with an action, or terms defined in text or the glossary.
italic Italic type indicates book titles, emphasis, or placeholder variables for
which you supply particular values.
monospace Monospace type indicates commands within a paragraph, URLs, code
in examples, text that appears on the screen, or text that you enter.
viii
What's New in This Guide
Screens shown in this guide may differ from your implementation, depending on the
skin used. Any differences are cosmetic.
The support for QuickFix Adapter has been deprecated in this release.
This guide has not been updated for the 12c 12.2.1.1.0 Release. The following table
lists the sections that have been added or changed.
ix
1
Event Processing Overview in Oracle
Stream Analytics
Oracle Stream Analytics is a high throughput and low latency platform for developing,
administering, and managing applications that monitor real-time streaming events.
This guide introduces you to Oracle Stream Analytics and Oracle JDeveloper for
application development. The step-by-step walkthroughs and sample applications
provide a solid foundation for understanding how the parts of the platform work
together and how to create an Oracle Stream Analytics application.
This chapter covers the following topics:
• Oracle Stream Analytics
• Application Programming Model
• Component Roles in an Event Processing Network
• Oracle CQL
• Technologies in Oracle Stream Analytics
• Oracle Stream Analytics High-Level Use Cases.
1-1
Chapter 1
Application Programming Model
1-2
Chapter 1
Component Roles in an Event Processing Network
• Events are handled as streams or relations: Channels convey events from one
stage to another in the EPN. A channel can convey events in a stream or in a
relation. Both stream and relation channels insert events into a collection and send
the stream to the next EPN stage. Events in a stream can never be deleted from
the stream. Events in a relation can be inserted into, deleted from, and updated in
the relation. For insert, delete, and update operations, events in a relation must
always be referenced to a particular point in time.
1-3
Chapter 1
Technologies in Oracle Stream Analytics
• Specify a window of a particular time period or range from which events should be
queried. This could be for every five seconds worth of events, for example.
• Specify a window of a particular number of events, called rows, against which to
query. This might be every sequence of 10 events.
• Specify how often the query should execute against the stream. For example, the
query could slide every five seconds to a later five-second window of events.
• Separate (partition) an incoming stream into multiple streams based on specified
event characteristics. You could have the query create new streams for each of
the specified stock symbols found in incoming trade events.
In addition, Oracle CQL supports common aspects of SQL that you might be familiar
with, including views and joins. For example, you can write Oracle CQL code that
performs a join that involves streaming event data and data in a relational database
table or cache.
Oracle CQL is extensible through data cartridges, with included data cartridges that
provide support for queries that incorporate functionality within Java classes. For
example, there is data cartridge support for spatial calculations and JDBC queries.
The spatial data cartridge supports a large number of moving objects, such as
complex polygons and circles, 3D positioning, and spatial clustering.
1-4
Chapter 1
Oracle Stream Analytics High-Level Use Cases
1-5
Chapter 1
Oracle Stream Analytics High-Level Use Cases
1-6
2
Oracle JDeveloper Quick Reference
Oracle Stream Analytics application development tasks can be performed in a number
of ways in Oracle JDeveloper with SOA Product Components for the 12c release. If
you are new to Oracle JDeveloper, you will discover other ways to locate the same
tasks as you become more familiar with it.
For more information, see http://www.oracle.com/technetwork/middleware/complex-
event-processing/downloads/index.html.
The following section describes one way to locate each task. This chapter covers the
following topics:
• Setting Accessibility Options
• Oracle Stream Analytics Support
• Open Oracle JDeveloper Windows
• Create an Oracle Stream Analytics Project
• Project Templates
• Assembly and Component Configuration Files
• Set the Path to Project Source Files
• Perform Project-Level Actions
• Import a Zip or JAR file
• EPN Diagram Features
• Components Window.
• Context Menus.
2-1
Chapter 2
Open Oracle JDeveloper Windows
2-2
Chapter 2
Project Templates
When you add components to the EPN, you can change the default configuration file
name to another file. If the alternate file already exists, Oracle JDeveloper saves the
configuration in that file. If the file does not already exist, Oracle JDeveloper creates
the file. For example, you might want to store all adapter configuration information in
the adapter.xml configuration file.
You can also explicitly create assembly and configuration files. See Assembly and
Configuration Files.
2-3
Chapter 2
Import a Zip or JAR file
Open EPN Diagram: Displays the Oracle Stream Analytics EPN diagram. See EPN
Diagram Features.
Configure JDBC Context: Use this option to configure a JDBC context. A JDBC
context defines an application context for an instance of an Oracle JDBC data
cartridge. Use this option only when you use a non-Oracle JDBC driver.
Configure Spatial Context: Use this option to configure a spatial context to manage a
large number of moving objects such as complex polygons and circles, 3D positioning,
and spatial clustering.
Deploy > oep-profile: Use this option to select an Oracle Stream Analytics
deployment bundle or to assemble a new deployment bundle.
Deploy > New Deployment Profile: Create a deployment profile for your application.
An application can have any number of deployment profiles.
Encryption Manager: Use this option to encrypt the application.
2-4
Chapter 2
EPN Diagram Features
Add Component
Drag a component from the Components window onto an empty area in the EPN to
build the EPN diagram. See Components Window.
Delete Component
Right-click the component and select Delete from the context menu or select the
component and press the Delete key.
Rename Component
1. Select the component on the EPN diagram.
Oracle JDeveloper highlights the component.
2. Click the component name.
The in-line name editor displays.
3. Change the name.
4. Click an empty area on the EPN diagram.
The in-line name editor closes.
Editors
You can edit an EPN through different Oracle JDeveloper editors: XML Source code,
property sheets, EPN Diagram, Manifest Editor, and so on. Validation annotations to
indicate errors show in all editors. The editors provide the following features when you
create Oracle CQL statements:
• Syntax highlighting
• Code completion
• Syntax validation
• Dynamic semantic validation
• Parameterized Oracle CQL statements
You can add a bindings block to an parameterized query. As you code the bindings
block, code completion suggests the binding ID with the list of available query IDS
within the current processor scope. The following example shows how to add a binding
block to a query.
<query id="helloworldRule">
<![CDATA[ select :1 from helloworldInputChannel ]]>
<bindings>
<binding id="helloworldRule">
<params id="param1">'My message is here: ' || message as message</params>
</binding>
</bindings>
Badges
A badge is a small icon that displays on a stage. The badge displays additional
information about the component. For example, if there is a validation error or warning
related to the component, the EPN editor displays the error or warning badge on that
component. When the situation causing the badge to appear resolves, the badge
disappears.
2-5
Chapter 2
Components Window
• Mouse over the badge to display the associated messages. Mouse click on the
annotation badge to display the associated messages and a link to detailed
information.
Zoom In or Out
You can zoom in or out on the EPN diagram in the following ways:
• Press the Ctrl key and mouse scroll.
• On the editor tool bar, choose a zooming value from the list of predefined zooming
values.
• Select or open the thumbnail panel and use the mouse scroll.
Nested Components
When you define a child stage inside a parent stage, the child stage is nested. The
nested stage is visible in the EPN diagram in an indented box. You cannot edit nested
stages, but you can delete them.
Only the parent stage can specify the child stage as a listener. You can drag
references from a nested element, but you cannot drag references to a nested
element.
Foreign Components
A foreign component (foreign stage) is a component that is defined in a different
application. On an EPN diagram, a foreign stage is visible as a ghost component. To
reference a foreign stage, use the following syntax in the assembly file:
• FOREIGN-APPLICATION-NAME:FOREIGN-STAGE-ID
Note:
When you reference foreign stages, you must consider foreign stage
dependencies when assembling, deploying, and redeploying an
application.
2-6
Chapter 2
Components Window
area on the EPN canvas and use the component wizard to configure it. You add the
component to the EPN by dragging a component already in the diagram to the new
component. The new component is placed to the right of the component that you
dragged.
See Create a Basic Application for step-by-step instructions.
The following list describes the components available on the Components window.
Base EPN Components:
• Adapter: Use an adapter to connect the EPN to external input or output data
sources. The Adapter component represents a generic adapter that you can
customize for your application requirements.
• Bean: Use a bean to define application event logic written in the Java
programming language that conforms to standard Spring-based beans. See http://
www.springsource.org/spring-framework.
• Cache: Use a cache to set up an area of random access memory (RAM) that
holds copies of recently accessed data for ready access by an application. You
must have a Cache System component in the EPN to add a Cache component.
• Channel: Use a channel to transfer events from stage to stage in the EPN.
• Event Bean: Use an event bean to define application event logic written in the
Java programming language that conforms to the JavaBeans specification. The
event bean is an Oracle extension to the regular Spring-based bean.
• Processor: Use a processor when you want to add Oracle CQL query code to
your application. Oracle CQL can read from the big data Hadoop and NoSQLDB
components.
• Table: Use a table as an external relation source. You can also use a table to
store events in the database by configuring the table as a listener of an upstream
component.
• Advanced Adapters:
– CSVInbound: Use a CSVInbound adapter to accept data in the form of
comma-separated values entering the EPN.
– CSVOutbound: Use a CSVOutbound adapter to send data in comma-
separated values out of the EPN.
– HTTP Publisher: Use an HTTP Publisher adapter to send JavaScript Object
Notation (JSON) event data out of the EPN to a web-based user interface.
– HTTP Subscriber: Use an HTTP Subscriber adapter to accept JavaScript
Object Notation (JSON) event data entering the EPN. JSON event data comes
from an HTTP server where user actions generate events.
– JMS Inbound: Use a JMS Inbound adapter to accept Java Message Service
(JMS) topics entering the EPN.
– JMS Outbound: Use a JMS Outbound adapter to send JMS topics out of the
EPN.
– REST Inbound: Use a REST Inbound adapter to consume events from HTTP
Post requests.
2-7
Chapter 2
Components Window
Note:
Oracle JDeveloper does not have an Oracle CQL visual editor.
WLS Extensions:
• RMIInbound: Use an RMIInbound adapter to receive incoming data sent from
Oracle WebLogic Server over the remote method invocation (RMI) protocol.
• RMIOutbound: Use an RMIOutbound adapter to send data to Oracle WebLogic
Server over the RMI protocol.
2-8
Chapter 2
Context Menus
EDN Adapters:
• EDNInbound: Use an EDNInbound adapter to receive incoming data from the
Oracle SOA Suite event network.
• EDNOutbound: Use an EDNOutbound adapter to send outbound data to the
Oracle SOA Suite event network.
Note:
These navigation options become disabled when a corresponding source
artifact cannot be found. For example, if an adapter does not have a
corresponding entry in a configuration XML file, its Go to Configuration
Source menu item is greyed out.
2-9
3
Oracle JDeveloper Procedures
The following sections describes how to perform Oracle Stream Analytics tasks in
Oracle JDeveloper.
This chapter covers the following topics:
• Import an Eclipse Project into Oracle JDeveloper
• Add a Library to a Project
• Create an Application Library
• Assembly and Configuration Files
• Configure a Relation Channel
• Configure an Application Time-Stamped Channel
• Create and Register a JavaBean Event Type
• Create and Register a Tuple Event Type
• Create an Event Bean
• Create a Spring Bean
• Configure a Table Source
• Configure a Table Sink
• Use Oracle CQL Patterns
• Configure an Oracle Coherence Caching System and Cache
• Configure a Local Caching System and Cache
• Debug Java Classes
• Testing with the Event Inspector Service
• Start and Stop Oracle JDeveloper and Servers.
3-1
Chapter 3
Import an Eclipse Project into Oracle JDeveloper
Note:
You can import a JDK1.6 Eclipse Oracle Stream Analytics application
project, but Oracle JDeveloper does not handle any compilation issues for
you. In this case, it is your responsibility to handle compilation issues if they
appear.
3-2
Chapter 3
Import an Eclipse Project into Oracle JDeveloper
Deploy
1. Right click the project.
The context menu displays.
2. From the context menu, select Deploy > New Deployment Profile.
The Create Deployment Profile dialog displays.
3. In the Create Deployment Profile dialog, choose a deployment profile, such as
OEP Project Deployment Profile, and give it a name.
4. Click OK.
The OEP Project Deployment Profile dialog displays.
5. In the OEP Project Deployment Profile dialog, you can either create a new
Oracle Stream Analytics server connection or select an existing connection.
To select an existing connection:
a. In the Connection to OEP Server drop-down list, select the existing connection
you want to use.
b. In the OEP Project Deployment Profile dialog, accept the defaults or provide
the requested profile details.
c. Click OK.
To create a new connection:
a. Click the Add (+) button to create an Oracle Stream Analytics server
connection.
The Create OEP Server Connection dialog displays.
3-3
Chapter 3
Import an Eclipse Project into Oracle JDeveloper
b. In the Create OEP Server Connection dialog, provide the connection details:
OEP Server Connection Name: SampleOEPConnection OEP Server Home
Path: /Oracle/Middleware/my_oep/ Use Default Values: Unchecked. OEP
Server Projects Directory: user_projects/domains/sample_domain/
defaultserverUse Default Values: Unchecked Host: localhost Port: 9002 Use
Default Values: Unchecked Username: oepadmin User Password: welcome1
Additional Parameters for OEP Server: blank
c. In the Create OEP Server Connection dialog, click Test Connection.
If everything is okay, then Success displays in the message box below the
Test Connection button. If you have errors, locate and fix the errors and try
again.
d. When you see Success, click OK.
The OEP Project Deployment Profile dialog displays.
e. In the OEP Project Deployment Profile dialog, accept the defaults or provide
the requested profile details.
f. Click OK.
To regenerate MANIFEXT.MF:
• Click the Recreate MANIFEXT.MF button to regenerate the manifest file.
The manifest file along with the imported and exported packages is
regenerated.
6. Right click the project and select the deployment profile you just selected or
created.
The Deploy <profile-name> dialog displays.
7. In the Deploy <profile-name> dialog, select Deploy OSGi bundle to target
platform and click Next.
The Summary dialog displays.
8. In the Summary dialog, review the settings and click Finish.
9. Wait a few moments while the deployment finishes.
The Deployment finished message displays on the Deployment - Log tab. If there
are problems starting the application, it undeploys automatically.
10. View the server log and the list of deployed applications.
3-4
Chapter 3
Add a Library to a Project
3-5
Chapter 3
Create an Application Library
Note:
In 12c the Oracle JDeveloper deployment profile supports only local
Oracle Event Processing connections.
3-6
Chapter 3
Assembly and Configuration Files
When you add components to the EPN, you can change the default configuration file
name to another file. If the alternate file already exists, Oracle JDeveloper saves the
configuration in that file. If the file does not already exist, Oracle JDeveloper creates
the file and saves the configuration in it. For example, you might want to store all
adapter configuration information in the adapter.xml configuration file. If you do not
specify any configuration settings when you create the component, Oracle JDeveloper
does not create a new configuration file because there is no configuration to put in it.
Note:
Identifiers and names in XML files are case sensitive. Use the same case
when you reference the component ID in the assembly file.
The walkthroughs in this guide have example assembly and configuration files that you
can study.
3-7
Chapter 3
Assembly and Configuration Files
3-8
Chapter 3
Configure a Relation Channel
Later, if you decide to provide default settings, you need to either create a
configuration file as described in Assembly and Configuration Files and add the
complete component configuration, or you can generate the configuration in the
default processor.xml file.
The maximum number of threads that Oracle Stream Analytics server can use to
process events for this channel is four.
3-9
Chapter 3
Configure an Application Time-Stamped Channel
If you make the channel a relation, you must also configure the primary-key
attribute. The primary key is a list of event property names separated by white
space or a comma that uniquely identifies each event.
3-10
Chapter 3
Create and Register a Tuple Event Type
3-11
Chapter 3
Create an Event Bean
3-12
Chapter 3
Create a Spring Bean
1. Optionally, create the JavaBean event type you want to use as described in Oracle
Fusion Middleware Developing Application for Oracle Stream Analytics .
In step 3, you can select an existing class or create a new one and add the logic
later.
2. In Oracle JDeveloper with the EPN diagram open, drag the Bean component from
the Components window to an empty area on the EPN diagram.
The New Bean wizard displays.
3. In the New Bean wizard, provide the following information:
Bean ID: A unique identifier for this event bean. Bean class: Add (+) or choose the
JavaBean class (event type) with the Spring functionality that you want to use for
this bean.
4. Click OK.
Oracle JDeveloper adds the event bean to the EPN.
5. Drag the upstream component to the event bean to place the event bean in its
correct location in the EPN.
The EPN diagram adjusts to show the event bean in its correct location.
Note:
Oracle recommends the Oracle JDBC data cartridge for accessing
relational database tables from an Oracle CQL statement.
3-13
Chapter 3
Configure a Table Source
Whether you use the NOW window or the data cartridge, you must define table sources
in the Oracle Stream Analytics server file.
The assembly file has entries to associate the Stock table with the proc processor
follows:
<wlevs:table id="Stock" event-type="TradeEvent" data-source="StockDataSource"/>
<wlevs:processor id="proc">
<wkevs:table-source ref="Stock" />
</wlevs:processor>
Note:
The XMLTYPE property is not supported for table sources.
3-14
Chapter 3
Configure a Table Sink
</driver-params>
<data-source-params>
<jndi-names>
<element>StockDataSource</element>
</jndi-names>
<global-transactions-protocol>None</global-transactions-protocol>
</data-source-params>
</data-source>
Because changes in the table source are not coordinated in time with stream data, you
can only join the table source to an event stream with a Now window, and you can only
join to a single database table.
The table-name element provides the name of the database table to which you want to
store the event data. The key-properties element provides the unique key value for the
database table to enable Oracle CQL queries that perform update and delete
operations.
3-15
Chapter 3
Use Oracle CQL Patterns
Assembly File
<wlevs:table id="StockSink" event-type="TradeEvent" data-source="StockDataSource"
table-name="StockEvents" key-properties="symbol" />
3-16
Chapter 3
Use Oracle CQL Patterns
Procedure
To add any of the available Oracle CQL patterns to the EPN, perform the following
steps. Each Oracle CQL pattern is stored within the context of an Oracle CQL
processor. The processor can already be in the EPN or not already be in the EPN.
If the processor is already in the EPN, drag and drop the pattern on the existing
processor. If the processor is not already in the EPN, start with step 2
1. Indicate the processor in which to store the Oracle CQL pattern:
a. If the processor is already in the EPN, drag and drop the pattern on the
existing processor.
b. If the processor is not already in the EPN, drag the pattern to an empty spot
on the EPN diagram.
Step 1 of the two-step wizard for that pattern displays with default values.
2. In the Oracle CQL Pattern wizard, Step 1 of 2 screen either accept the defaults
or enter the following values. Note that these values cannot be changed when you
drag and drop the Oracle CQL pattern on an existing processor.
Processor ID: A unique ID value of the Oracle CQL processor which will store this
Oracle CQL pattern. Oracle JDeveloper provides a default unique ID.
File Name: The name of the configuration file where you want the Oracle CQL
pattern configuration stored. Oracle JDeveloper provides the existing
processor.xml configuration file for the default. If you selected an existing Oracle
CQL processor, the file name field is unavailable because Oracle JDeveloper
stores the Oracle CQL pattern configuration in the same file with the processor.
3. Click Next.
Step 2 of the two-step wizard for that pattern displays with default values where
possible.
4. In the Oracle CQL Pattern wizard, Step 2 of 2 screen, accept the default values
where appropriate and enter values where needed.
To obtain information about valid values for a field, put your cursor in the field and
read the property description in the right panel or Click Help.
Step 2 has a parameters section on top with the Oracle CQL statement template
below. As you provide parameters in the top section, the template reflects your
inputs with color coding as shown in the following figure:
3-17
Chapter 3
Use Oracle CQL Patterns
5. Click Finish.
Oracle JDeveloper adds the Oracle CQL processing code to the processor without
overwriting any existing rules. In this example the processor.xml file contains the
following entries for the MyProcessor Oracle CQL processor
<processor>
<name>MyProcessor</name>
<rules>
<query id="RecordQuery"><![CDATA[
SELECT name
FROM MyChannel
WHERE name = “Johnson" ]]>
</query>
</rules>
</processor>
If the processor is not already in the EPN, the new processor that contains the
Oracle CQL pattern code is added to the EPN and connected to the component
indicated in the Source field.
3-18
Chapter 3
Configure an Oracle Coherence Caching System and Cache
• All tables
• All hadoop:files
• All nosql:stores
Note:
Before you can legally use Oracle Stream Analytics with Oracle Coherence,
you must obtain a valid Coherence license such as a license for Coherence
Enterprise Edition, Coherence Grid Edition, or Oracle WebLogic Application
Grid.
For more information on Oracle Coherence, see http://www.oracle.com/
technetwork/middleware/coherence/overview/index.html.
3. Click Next.
The Coherence Cache System - Step 2 of 4 dialog displays.
4. In the Coherence Cache System - Step 2 of 4 dialog, provide the following
values:
3-19
Chapter 3
Configure an Oracle Coherence Caching System and Cache
Cache name: The name of the first cache in your Oracle Coherent caching
system. Value Type: The type for values contained in the cache. Must be a valid
type name in the event type repository.
5. Click Next.
The Coherence Cache System - Step 3 of 4 dialog displays.
6. In the Coherence Cache System - Step 3 of 4 dialog, select the Advertise check
box.
Selecting the Advertise check box means that the caching system allows other
applications to access this cache system.
7. Click Next.
The Coherence Cache System - Step 4 of 4 dialog displays.
8. In the Coherence Cache System - Step 4 of 4 dialog, click Finish.
Example 3-4 Assembly File
The assembly file contains the information you provided when you created the caching
system and cache1. This cache is advertised.
<wlevs:cache id="cache1" value-type="TradeReport" advertise="true">
<wlevs:caching-system ref="coherence-caching-system"/>
</wlevs:cache>
<wlevs:caching-system id="coherence-caching-system" provider="coherence"/>
Note:
When you change the id setting for a coherence cache in the EPN diagram,
the id changes in the assembly file and in the coherence-cache-config.xml
file. However, if you change the id setting in the assembly file source editor,
the id changes in the assembly file only. In this case, you must manually
change the cache-name setting in the coherence-cache-config.xml to match the
id setting in the assembly file. You also have to change all references to that
cache.
3-20
Chapter 3
Configure an Oracle Coherence Caching System and Cache
Note:
When you have Oracle Coherence caches in the EPN assembly files of one
or more applications deployed to the same Oracle Stream Analytics server,
never configure multiple instances of the same cache with a loader or a
store.
You can inadvertently do this by employing multiple applications that each
configure the same Oracle Coherence cache with a loader or store in their
respective EPN assembly file. If you configure multiple instances of the same
cache with a loader or a store, Oracle Stream Analytics throws an exception.
An Oracle Stream Analytics Oracle Coherence factory must be declared when you use
Spring to configure a loader or store for a cache. You specify the factory with the
cachestore-scheme element and include a factory class that enables Oracle Coherence
to call into Oracle Stream Analytics and retrieve a reference to the loader or store that
is configured for the cache. The only difference between configuring a loader or store
is that the method-name element has a value of getLoader when a loader is used and
getStore when a store is being used. You pass the cache name to the factory as an
input parameter.
<cache-config>
<caching-scheme-mapping>
<cache-mapping>
<cache-name>myCoherenceCache</cache-name>
<scheme-name>new-replicated</scheme-name>
</cache-mapping>
<cache-mapping>
<cache-name>myLoaderCache</cache-name>
<scheme-name>test-loader-scheme</scheme-name>
</cache-mapping>
<cache-mapping>
<cache-name>myStoreCache</cache-name>
<scheme-name>test-store-scheme</scheme-name>
</cache-mapping>
<cache-mapping>
<cache-name>
cache1
</cache-name>
<scheme-name>
new-replicated
</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<replicated-scheme>
<scheme-name>new-replicated</scheme-name>
3-21
Chapter 3
Configure an Oracle Coherence Caching System and Cache
<service-name>ReplicatedCache</service-name>
<backing-map-scheme>
<class-scheme>
<scheme-ref>my-local-scheme</scheme-
ref>
</class-scheme>
</backing-map-scheme>
</replicated-scheme>
<class-scheme>
<scheme-name>my-local-scheme</scheme-name>
<class-name>com.tangosol.net.cache.LocalCache</class-name>
<eviction-policy>LRU</eviction-policy>
<high-units>100</high-units>
<low-units>50</low-units>
</class-scheme>
<local-scheme>
<scheme-name>test-loader-scheme</scheme-name>
<eviction-policy>LRU</eviction-policy>
<high-units>100</high-units>
<low-units>50</low-units>
<local-scheme>
<scheme-name>test-store-scheme</scheme-name>
<eviction-policy>LRU</eviction-policy>
<high-units>100</high-units>
<low-units>50</low-units>
3-22
Chapter 3
Configure a Local Caching System and Cache
<param-type>java.lang.String</param-type>
<param-value>myCoherenceCache</param-value>
</init-param>
<init-param>
<param-type>
java.lang.String
</param-type>
<param-value>
cache1
</param-value>
</init-param>
</init-params>
</class-scheme>
</cachestore-scheme>
<!-- The cachestore-scheme element ends here -->
</local-scheme>
</caching-schemes>
</cache-config>
Note:
Do not include the tangosol-coherence-override.xml file when you use Oracle
Coherence for clustering.
Add the following XML to the Oracle Coherence configuration file to reference the
tangosol-coherence-override.xml file. Include the cluster-name element to prevent
Oracle Coherence from attempting to join existing Oracle Coherence clusters when
Oracle Stream Analytics starts up. This can cause problems and sometimes prevent
Oracle Stream Analytics from starting.
...
<coherence xml-override="/tangosol-coherence-override.xml">
<cluster-config>
<member-identity>
<cluster-name>com.bea.wlevs.example.provider</cluster-name>
</member-identity>
...
</coherence>
3-23
Chapter 3
Configure a Local Caching System and Cache
when you do not plan to deploy your application to a multiserver domain. If you plan to
deploy your application to a multiserver domain, use an Oracle Coherence cache.
6. In the Local Cache System - Step 2 of 5 dialog, select the Advertise check box.
Selecting the Advertise check box means that the caching system allows other
applications to access this cache system.
7. Click Next.
The Local Cache System - Step 3 of 5 dialog displays.
8. In the Local Cache System - Step 3 of 5 dialog, provide the following values:
Cache name: The name of the first cache in your Oracle Coherent caching
system. Value Type: The event type into which you want to load the database
values.
9. Click Next.
The Local Cache System - Step 4 of 5 dialog displays
10. In the Local Cache System - Step 4 of 5 dialog, accept the defaults or provide
the values you want.
11. Click Finish.
Example 3-7 Assembly File
The assembly file has the values you specified when you created the local caching
system.
<wlevs:cache id="localcache" value-type="HelloWorldEvent">
<wlevs:caching-system ref="caching-system"/>
</wlevs:cache>
<wlevs:caching-system id="caching-system" class="hellowworld.MyClass"
advertise="false"/>
3-24
Chapter 3
Debug Java Classes
<caching-system>
<name>caching-system</name>
<cache>
<name>localcache</name>
<max-size>64</max-size>
<eviction-policy>LFU</eviction-policy>
</cache>
</caching-system>
3-25
Chapter 3
Debug Java Classes
4. In the Configure Java Settings dialog, click Next to accept the defaults.
5. In the Configure OEP technology settings dialog in the OEP Application
Template Name drop-down list, select HelloWorld.
6. In the Configure OEP technology settings dialog in the OEP Server
Connections drop-down list, select LocalCon1.
7. Click Finish.
To change the connection on an existing project to LocalCon1:
1. Right-click the project and select Project Properties from the context menu.
2. In the Project Properties dialog in the left window, select Deployment.
3. In the Deployment window, leave the User Project Settings radio button
selected, and under Deployment Profiles, select the profile you want to edit.
4. Click Edit.
5. In the Deployment Properties panel in the Connection to OEP Server drop-
down list, select LocalCon1.
6. Click OK.
UNIX:
./startwlevs.sh -debug
2. Right-click the project and select Project Properties from the context menu.
The following messages display in the Messages - Log window:
Listening for transport dt_socket at address 8453
8453 is the default port.
3. In the Project Properties dialog in the left window, select Run/Debug.
4. In the right panel under Run/Debug, accept the default settings and click Edit.
You can first click New to create a new Run Configuration if you want to.
5. Select Launch Settings in the left window, and in the right window, select the
Remote Debugging check box.
6. Select Tool Settings > Debugger > Remote in the left window, and in the right
panel set the host and port parameters.
In this example, the host is LocalHost and the port is 8453.
7. Click OK and click OK again to dismiss the dialogs.
3-26
Chapter 3
Debug Java Classes
Set Breakpoints
1. To set breakpoints, open any Java class in the project.
In the HellowWorld project, you could open the source code file for
HelloWorldBean.java.
3-27
Chapter 3
Testing with the Event Inspector Service
3-28
Chapter 3
Start and Stop Oracle JDeveloper and Servers
<pubsub-server-url>http://HOST:PORT/PATH</pubsub-server-url>
</event-inspector>
HOST: The host name or IP address of the remote Oracle Stream Analytics server.
PORT: The remote Oracle Stream Analytics server netio port as defined in the
remote Oracle Stream Analytics server file. Default: 9002.
PATH: The value of the http-pubsub element path child element as defined in the
remote Oracle Stream Analytics server file.
Given the http-pubsub configuration that the example shows, a valid pubsub-
server-url would be as follows:
http://remotehost:9002/pubsub
3-29
Chapter 3
Start and Stop Oracle JDeveloper and Servers
b. UNIX:
• ./startwlevs.sh
The parameter —Dprofile-<xxx> where <xxx> is one of the available profiles (set
of loaded bundle features specified in <MW_HOME>/oep/features/
bundleloader_profileName.xml) can be used with the script startwlevs script to start
the server.
The terminal panel displays messages as the server starts. When you see, <The
application context for "com.bea.wlevs.dataservices" was started successfully
>, the Oracle Stream Analytics server is ready.
Alternately, within Oracle JDeveloper you can start Oracle Stream Analytics after you
have defined a connection to an Oracle Stream Analytics server. Then, you can find a
way to start the Oracle Stream Analytics server under Application Resources when
you expand the Connections folder.
b. UNIX:
• ./stopwlevs.sh
The terminal panel displays messages as the server starts. When you see, <The
application context for "com.bea.wlevs.dataservices" was started successfully
>, the Oracle Stream Analytics server is ready.
3-30
4
Create a Basic Application
This chapter walks through building a basic Oracle Stream Analytics application. The
steps include explanations of key Oracle Stream Analytics application programming
concepts.
This chapter covers the following topics:
• About the Basic Application
• Before You Begin
• Create the Application
• TradeReport Project Files
• Create an Event Type to Carry Event Data
• Add the csvgen Adapter to Receive Simulated Event Data
• Add an Output Channel to Convey Events
• Create a Listener Event Sink to Receive and Report Events
• Add an Oracle CQL Processor to Filter Events
• Add an Output Channel
• Deploy
• Set Up and Start the Load Generator
• Stop the Load Generator and the Server.
4-1
Chapter 4
Before You Begin
Optionally, you can set the WLEVS_HOME variable to point to the installation directory. The
Oracle Stream Analytics JDeveloper plug-in uses this variable to detect the local
Oracle Stream Analytics server.
Note:
This walkthrough introduces features specific to Oracle Stream Analytics and
assumes that you are familiar with basic Java programming.
4-2
Chapter 4
TradeReport Project Files
3. In the Create OEP Application Step 1 of 4 dialog, enter the following values:
Application Name: TradeReport Directory: Accept the default Application Package
Prefix: Leave blank
4. Click Next.
The Create OEP Application - Step 2 of 4 screen displays.
5. In the Create OEP Application - Step 2 of 4, dialog, enter the following values:
Project Name: TradeReport Directory: Accept the default Project Features: OEP
Suite
6. Click Next.
The Create OEP Application - Step 3 of 4 dialog displays.
7. In the Create OEP Application - Step 3 of 4 dialog, click Next to accept the
defaults:
The Create OEP Application - Step 4 dialog displays.
8. In the Create OEP Application - Step 4 of 4 dialog, examine the default values:
Empty OEP Project: Provides the basic structure of an Oracle Stream Analytics
application.
OEP Server Connections: Leave blank. In a later step, you create the Oracle
Stream Analytics server connection.
9. Click Finish to accept the defaults.
The Oracle Stream Analytics TradeReport application and project displays.
Projects Window
• spring subfolder that contains the TradeReport.context.xml assembly file. The
assembly file conforms to the Spring framework and contains the contents and
structure of the TradeReport EPN.
The assembly file also contains the default configuration for each EPN stage. This
default configuration cannot be changed at run time without redeploying the
application. As you add and connect stages on the EPN diagram, Oracle
JDeveloper captures your work in this file. You can also edit this file manually.
Note:
The EPN assembly file XML schema extends the Spring framework
configuration file. See the Spring website at http://
www.springsource.org/spring-framework.
4-3
Chapter 4
Create an Event Type to Carry Event Data
• wlevs subfolder that contains the default processor.xml configuration file. The files
in the wlevs folder describe components with configurations that can be edited at
runtime with Oracle Stream Analytics Visualizer. As you use Oracle JDeveloper to
create components, you can place their configurations in the processor.xml file or
specify another component configuration file to group component types in the
same file. You can also edit configuration files manually.
• EPN diagram The EPN diagram represents the components that make up the
application. Event data enters your application from the left of the diagram, and
moves to the right from stage to stage.
The EPN diagram shows a graphical representation of the underlying EPN
configuration. When you add a component to the EPN, Oracle JDeveloper writes
information to the TradeReport.context.xml assembly file and the configuration file.
• MANIFEST.MF that describes the contents of the OSGi bundle that you deploy to
the Oracle Stream Analytics server.
Resources Window
The Resources window, which is on the right side of Oracle JDeveloper under IDE
Connections, provides information about running server connections.
The data columns are not labeled in the CSV file, but if they were labeled, they would
have the corresponding Java data type shown in Table 4-1. The Java data types that
define an event type are referred to as properties in Oracle Stream Analytics.
4-4
Chapter 4
Create an Event Type to Carry Event Data
4-5
Chapter 4
Create an Event Type to Carry Event Data
2. To generate the accessor methods, right click anywhere in the source editor.
The source editor pop-up menu displays.
3. In the source editor pop-up menu, select Generate Accessors.
The Generate Accessors dialog displays.
4. In the Generate Accessors dialog, click the Select All button and click OK.
5. Close the TradeEvent.java tab and save the file.
Note:
The Properties defined declaratively radio button is for defining events
as tuples.
4-6
Chapter 4
Add the csvgen Adapter to Receive Simulated Event Data
Notice that Oracle Stream Analytics manages event types in an event type repository,
and that the TradeEvent event type contains (maps to) the tradereport.TradeEvent
class.
Note:
Before you deploy an application to the final production environment, you
must switch to an input adapter that can read the type of incoming data your
application will receive in production.
In this procedure, you declare the adapter and set its properties. When completed, the
EPN diagram displays the adapter to create the first stage in your TradeReport EPN.
Note:
No white spaces allowed between the instance-property name values.
The order of the name values must match the order in the StockData.csv
files described in View the Test Data.
The XML stanza declares an instance of the csvgen adapter and assigns to it
three properties that configure it for use in your EPN. The adapter uses the
properties to map from incoming raw event data to the properties of the event type
you defined.
4-7
Chapter 4
Add an Output Channel to Convey Events
id: A unique identifier for the adapter. The provider attribute value must be csvgen
to refer to the csvgen implementation included with Oracle Stream Analytics.
port: Tells the adapter instance what port to listen on for incoming event data. The
value here, 9200, corresponds to the port number to which the load generator will
send event data (more on that later).
The eventTypeName: Tells the instance the name of the event type to which
incoming event data should be assigned. Here, you give the name of the
TradeEvent type you defined earlier.
eventPropertyNames. Tells the instance the names of the event type properties to
which data should be assigned. Notice in this case that the eventPropertyNames: A
comma-separated list of the same properties you defined in the JavaBean for the
event type. In order for the csvgen adapter to map from incoming values to event
type properties, the names here must be the same as your event type and must be
in the same order as corresponding values for each row of the CSV file.
3. Save and close the TradeReport.context.xml assembly file.
The StockTradeCSVAdapter displays on the EPN diagram to create the first
stage in your TradeReport EPN network.
4. Open the EPN diagram to see the StockTradeCSVAdapter:
4-8
Chapter 4
Create a Listener Event Sink to Receive and Report Events
This action creates a connecting line between the two icons and places the
AdapterOutputChannel to the right of the StockTradeCSVAdapter, which indicates
that events flow from the adapter to the channel.
When you created the connection between the adapter and the channel, Oracle
JDeveloper added a reference to a listener. The listener ref attribute is set to the
id attribute of the channel element meaning that the channel listens for events that
come from the adapter.
3. Close the TradeReport.context.xml tab and save the file.
4-9
Chapter 4
Create a Listener Event Sink to Receive and Report Events
import com.bea.wlevs.ede.api.EventRejectedException;
import com.bea.wlevs.ede.api.StreamSink;
The onInsertEvent method listens for trade events, and when it hears a TradeEvent,
it calls the tradereport.TradeEvent get methods to get the stock symbol and the
trade volume, and to print the stock symbol and trade volume information to the
console.
8. Close the TradeListener.java tab and save the file.
4-10
Chapter 4
Add an Oracle CQL Processor to Filter Events
Note:
There are no configuration file entries for the channel beyond the default
configuration. You can edit the processor.xml file to customize the channel
configuration or create a separate configuration file, such as channel.xml, for
channels and add custom channel configuration to it. See Add Configuration
Settings to a Component.
4-11
Chapter 4
Add an Oracle CQL Processor to Filter Events
4-12
Chapter 4
Add an Output Channel
4.11 Deploy
To deploy the example application for testing, you must perform certain actions.
• Create an Oracle Stream Analytics Domain
• Start the Oracle Stream Analytics Server
4-13
Chapter 4
Deploy
b. On UNIX:
• prompt> ./startwlevs.sh
4-14
Chapter 4
Deploy
The terminal window displays messages as the server starts. When you see, <The
application context for "com.bea.wlevs.dataservices" was started successfully
>, the Oracle Stream Analytics server is ready.
Note:
Make sure you select the correct Profile Type, which is OEP Project
Deployment Profile.
4-15
Chapter 4
Set Up and Start the Load Generator
<username>/jdeveloper/mywork/TradeReport/TradeReport/deploy/
basicapp_profile.jar.
5. Click OK.
4-16
Chapter 4
Stop the Load Generator and the Server
Note:
The order of the event properties in the StockData.csv file must match the
order of event properties specified in Create the csvgen Adapter and Set
Its Properties.
4-17
Chapter 4
Stop the Load Generator and the Server
4-18
5
Create a Fraud Detection Application with
EDN Adapters
This chapter walks through the steps to create and deploy a fraud detection
application to present two major new features in the Oracle Stream Analytics 12c
release. The first feature is support for the entire Oracle Stream Analytics application
life cycle with Oracle JDeveloper. The second feature is Event Delivery Network (EDN)
adapter support so that an Oracle Stream Analytics application can send events to and
receive events from Oracle SOA Suite. You create and deploy the Oracle Stream
Analytics fraud detection application entirely in Oracle JDeveloper.
This chapter covers the following topics:
• Fraud Detection Scenario
• Before You Begin
• Event Delivery Network Walkthrough.
5-1
Chapter 5
Event Delivery Network Walkthrough
Note:
Although this walkthrough introduces features specific to Oracle Stream
Analytics, it assumes that you are familiar with basic Java programming.
5-2
Chapter 5
Event Delivery Network Walkthrough
5-3
Chapter 5
Event Delivery Network Walkthrough
9. In the Configuration Options screen, click Next to not perform any optional
configuration.
The Create OEP Domain screen displays.
10. In the Create OEP Domain screen, enter fraudcheck_domain and make a note
of its location.
The location will be something like /Oracle/Middleware/my_oep/user_projects/
domains.
11. Click Create, and after a few moments, click Done.
2. Add the following system properties to the JAVA_HOME command line at the bottom
of the file.
The system properties go before the -jar $USER_INSTALL_DIR setting.
-Dedn.jms.topic="jms/fabric/EDNTopic" -Dedn.jms.connection-factory="jms/fabric/
EDNConnectionFactory"
The final JAVA_HOME line in startwlevs.sh looks like this: (all on one line):
"$JAVA_HOME/bin/java" $JVM_ARGS $JVM_D64 $DEBUG_ARGS
-Dwlevs.home="$USER_INSTALL_DIR"
-Dedn.jms.topic="jms/fabric/EDNTopic"
-Dedn.jms.connection-factory="jms/fabric/EDNConnectionFactory"
-jar "${USER_INSTALL_DIR}/bin/wlevs.jar" $ARGS
The system properties instruct the Oracle Stream Analytics server to use the JMS
implementation for the EDN rather than the default, which is Advanced Queuing
(AQ).
5-4
Chapter 5
Event Delivery Network Walkthrough
5-5
Chapter 5
Event Delivery Network Walkthrough
b. On UNIX:
• prompt> ./startwlevs.sh
The terminal window displays messages as the server starts. When you see, <The
application context for "com.bea.wlevs.dataservices" was started successfully
>, the Oracle Stream Analytics server is ready.
5-6
Chapter 5
Event Delivery Network Walkthrough
10. If you cannot see the empty EPN Diagram tab and the components panel, go to
the Applications panel, expand FraudCheck > OEP Content and double-click
EPN Diagram.
5-7
Chapter 5
Event Delivery Network Walkthrough
c. Select the FraudCheckEvent.edl file inside the folder and click OK.
7. Under Edl Properties, select FraudCheckRequest from the Event Type drop-
down list.
8. In the EDN Inbound Adapter Configuration dialog, under Advanced
Properties, select the schema file associated with the FraudCheckEvent.edl file
as follows:
a. Click the search icon (magnifying glass) next to the Schema File field.
b. Navigate to the location where you unzipped the
OEP_Fraud_Detection_Walkthrough_Files.zip file.
c. Select the FraudCheckType.xsd file inside the folder and click OK.
9. Click Finish.
Two informational dialogs display about the files you are uploading.
10. Read the informational message and press OK to dismiss them.
The EDN diagram displays the edn-inbound-adapter that you just created, and the
Fraud Check project lists the files that you uploaded.
11. Select File > Save to save your work.
5-8
Chapter 5
Event Delivery Network Walkthrough
5-9
Chapter 5
Event Delivery Network Walkthrough
3. Click OK.
The EDN diagram displays the ednprocessor that you just created.
4. Select File > Save to save your work.
You replace the sample Oracle CQL including <rules>..</rules> with the following
Oracle CQL code:
<rules>
<view id="FraudView"><![CDATA[
select S.properties as properties,
cast@java(S.javaContent,
com.oracle.oep.FraudCheckRequest.class).getOrderNumber() as orderNumber,
cast@java(S.javaContent,
com.oracle.oep.FraudCheckRequest.class).getEmail() as email,
cast@java(S.javaContent,
com.oracle.oep.FraudCheckRequest.class).getTotalAmount() as totalAmount
from ednInputChannel as S
]]></view>
<!--
With id=FraudViewAmountOk, the view and query statements detect the case where
the sum of all order amounts from a specific email over a 24 hour period is less
than $1000. In this case, he query issues a FraudCheckResponseEvent with status
OK.
-->
<view id="FraudViewAmountOk"><![CDATA[
select email
from FraudView[range 24 hours]
group by FraudView.email
having sum(FraudView.totalAmount) <= 1000.0
]]></view>
<query id="FraudQueryAmountOk"><![CDATA[
select V1.properties as properties,
FraudCheckResponse(V1.orderNumber, "OK")
as javaContent
from FraudView[partition by email rows 1] as V1, FraudViewAmountOk as V2
where V1.email = V2.email
]]></query>
<!--
With id= FraudViewAmountAlert, the view and query statements detect the case
where the sum of all order amounts from a specific email over a 24 hour period
is greater than $1000. In this case, the query issues a FraudCheckResponseEvent
5-10
Chapter 5
Event Delivery Network Walkthrough
<view id="FraudViewAmountAlert"><![CDATA[
select email
from FraudView[range 24 hours]
group by FraudView.email
having sum(FraudView.totalAmount) > 1000.0
]]></view>
<query id="FraudQueryAmountAlert"><![CDATA[
select V1.properties as properties,
FraudCheckResponse(V1.orderNumber, "THRESHOLD_EXCEEDED")
as javaContent
from FraudView[partition by email rows 1] as V1, FraudViewAmountAlert
as V2 where V1.email = V2.email
]]></query>
</rules>
4. Select File > Save to save your work.
5. Click the EPN Diagram tab to return to the EPN diagram.
5-11
Chapter 5
Event Delivery Network Walkthrough
Because you already loaded this file, you can also locate it under $HOME/
jdeveloper/mywork/Application1/FraudCheck/META-INF/wlevs/edn.
c. Select the FraudCheckEvent.edl file inside the folder and click OK.
5-12
Chapter 5
Event Delivery Network Walkthrough
When you load the FraudCheckEvent.edl file, the Event Type drop-down list is
populated with events to use in the Fraud Check application.
6. In the EDN Outbound Adapter Configuration dialog, in the Event Type drop-down
list, select FraudCheckResponse.
7. Click Finish.
The EDN diagram displays the edn-inbound-adapter that you just created, and the
Fraud Check project lists the files that you uploaded.
8. Select File > Save to save your work.
5-13
Chapter 5
Event Delivery Network Walkthrough
Note:
Make sure you select the correct Profile Type, OEP Project Deployment
Profile.
5-14
Chapter 5
Event Delivery Network Walkthrough
5-15
Chapter 5
Event Delivery Network Walkthrough
When the modified SOA composite successfully deploys, it creates a default JMS
mapping for the FraudCheckRequest and FraudCheckResponse event types. It is
likely that this JMS mapping uses AQ, instead of WLS JMS. To interoperate with
this Oracle Stream Analytics application, the JMS mapping for these specific event
types needs to be changed to use WLS JMS. The mapping change is done with
Oracle Enterprise Manager, which is part of Oracle SOA Suite.
5-16
Chapter 5
Event Delivery Network Walkthrough
5-17
Chapter 5
Event Delivery Network Walkthrough
9. In the Summary dialog, review the settings for accuracy, and click Finish.
When the modified SOA composite successfully deploys, it creates a default JMS
mapping for the FraudCheckRequest and FraudCheckResponse event types. It is
likely that this JMS mapping uses AQ, instead of WLS JMS. To interoperate with
this Oracle Stream Analytics application, the JMS mapping for these specific event
types needs to be changed to use WLS JMS. The event types change is done with
Oracle Enterprise Manager, which is part of Oracle SOA Suite
Log in to Enterprise Manager and navigate to the Test Web Service Screen
1. Open a browser, and enter localhost:7101/em into the URL box.
The Enterprise Manager login screen displays.
2. Log in to Enterprise Manager with the user name weblogic and the password
welcome1.
The SOA Infrastructure screen displays.
3. In the SOA Infrastructure screen left panel under Target Navigation, expand SOA
> soa-infra (Default Server) > default and select EDNOEPv2Proj.
4. In the SOA Infrastructure right panel, press the Test button.
Test the SOA Composite and the Oracle Stream Analytics Application
1. On the Test Web Service screen, scroll down in the right panel until you see the
Input Arguments section.
2. In the Input Arguments section under SOAP Body, notice that there are two
fields, email and amount.
The email and amount fields let you enter an email address and an amount to be
passed to the Oracle Stream Analytics application. The email address is used by
5-18
Chapter 5
Event Delivery Network Walkthrough
the Oracle CQL Group By clause to identify each collection of related orders and
the dollar amount value.
3. In the email field, enter an email address, and in the amount field, enter 200.00.
4. Scroll to the top of the page and click Test Web Service.
Check the terminal window where you started Oracle WebLogic server. You see a
message like the following that lets you know that a FraudCheckEvent has been
published to the file:
INFO: Publishing Event "{http://xmlns.oracle.com/Application2/Project1/
FraudCheckEvent}FraudCheckResponse" to Topic="jms/fabric/EDNTopic",
JmsType=WLJMS, isXA=false
5. With the same email address, enter more amounts and click Test Web Service
until you have submitted more than $1000 worth of events.
6. With a text editor, navigate to the directory for the oepToedn-
output_PRODUCTION.txt file and open it.
For the created order number, the record status is THRESHOLD EXCEEDED. This status
was determined by the Oracle CQL statements in the Oracle Stream Analytics
Application.
5-19
Chapter 5
Event Delivery Network Walkthrough
5-20
6
Create an Order Tracking Application with
QuickFix Adapter
The QuickFix Adapter is a messaging engine for handling the real-time electronic
exchange of securities transactions according to the Financial Information eXchange
(FIX) standard. The QuickFix adapter listens for FIX messages, converts the FIX
messages to Oracle Stream Analytics events, and sends the events to the next stage
for processing.
This chapter includes the following sections:
• Order Tracking Example Application
• Test the Example Application.
The example is comprised of the following configuration and Java class files:
• Assembly File
• Configuration File
• QuickFIXEvent.java
• EventListerner.java
Assembly File
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:wlevs="http://www.bea.com/ns/wlevs/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
6-1
Chapter 6
Order Tracking Example Application
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://www.bea.com/ns/wlevs/spring
http://www.bea.com/ns/wlevs/spring/spring-wlevs-v12_1_3_0.xsd
<wlevs:event-type-repository>
<wlevs:event-type type-name="QuickFIXEvent">
<wlevs:class>event.QuickFIXEvent</wlevs:class>
</wlevs:event-type>
</wlevs:event-type-repository>
Configuration File
The following entries show the QuickFix adapter configuration. The configuration
requires at least one <default-session> property value and can have zero or more
<session> tags.
The BeginString property indicates the FIX message version. This data is not validated
by the QuickFIX engine.
Note:
Oracle Stream Analytics does not support QuickFIX dynamic acceptor
sessions in the 12c release.
6-2
Chapter 6
Order Tracking Example Application
</configuration>
<configuration>
<config-name>UseDataDictionary</config-name>
<config-value>N</config-value>
</configuration>
<configuration description="identifier-message format">
<config-name>BeginString</config-name>
<config-value>FIX.4.2</config-value>
</configuration>
<configuration>
<config-name>ConnectionType</config-name>
<config-value>acceptor</config-value>
</configuration>
<configuration>
<config-name>StartTime</config-name>
<config-value>00:00:00</config-value>
</configuration>
<configuration>
<config-name>EndTime</config-name>
<config-value>00:00:00</config-value>
</configuration>
<configuration>
<config-name>HeartBtInt</config-name>
<config-value>30</config-value>
</configuration>
<configuration>
<config-name>SocketAcceptPort</config-name>
<config-value>9876</config-value>
</configuration>
<configuration>
<config-name>RefreshMessageStoreAtLogon</config-name>
<config-value>Y</config-value>
</configuration>
</default-session>
QuickFIXEvent.java
package event;
6-3
Chapter 6
Test the Example Application
@Override
public String toString() {
StringBuilder sb=new StringBuilder();
sb.append("\t\t\t[origClOrdID=").append(origClOrdID).append("]\n")
.append("\t\t\t[clOrdID=").append(clOrdID).append("]\n")
.append("\t\t\t[symbol=").append(symbol).append("]\n")
.append("\t\t\t[side=").append(side).append("]\n")
.append("\t\t\t[text=").append(text).append("]\n");
return sb.toString();
}
}
EventListerner.java
The EventListener.java class is used in the example code follows.
package listeners;
import com.bea.wlevs.ede.api.EventRejectedException;
import com.bea.wlevs.ede.api.StreamSink;
6-4
Chapter 6
Test the Example Application
• SampleInitiator.java
• initiator_sample.cfg
• runInitiator.bat
Note:
You need to replace some values shown in the following examples based on
your environment.
QuickFixSampleInitiatorApp.java
package proto.quickfix;
import java.io.FileInputStream;
import quickfix.Acceptor;
import quickfix.Application;
import quickfix.DefaultMessageFactory;
import quickfix.FileLogFactory;
import quickfix.FileStoreFactory;
import quickfix.Initiator;
import quickfix.LogFactory;
import quickfix.MessageFactory;
import quickfix.MessageStoreFactory;
import quickfix.ScreenLogFactory;
import quickfix.Session;
import quickfix.SessionNotFound;
import quickfix.SessionSettings;
import quickfix.SocketAcceptor;
import quickfix.SocketInitiator;
import quickfix.field.ClOrdID;
import quickfix.field.OrigClOrdID;
import quickfix.field.Side;
import quickfix.field.Symbol;
import quickfix.field.Text;
6-5
Chapter 6
Test the Example Application
SampleInitiator.java
package proto.quickfix;
import quickfix.Application;
import quickfix.DoNotSend;
import quickfix.FieldNotFound;
import quickfix.IncorrectDataFormat;
import quickfix.IncorrectTagValue;
import quickfix.Message;
import quickfix.RejectLogon;
import quickfix.Session;
import quickfix.SessionID;
import quickfix.SessionNotFound;
import quickfix.UnsupportedMessageType;
import quickfix.field.ClOrdID;
import quickfix.field.OrigClOrdID;
import quickfix.field.Side;
import quickfix.field.Symbol;
import quickfix.field.Text;
@Override
public void fromAdmin(Message arg0, SessionID arg1) throws FieldNotFound,
IncorrectDataFormat, IncorrectTagValue, RejectLogon { }
@Override
public void fromApp(Message arg0, SessionID arg1) throws FieldNotFound,
IncorrectDataFormat, IncorrectTagValue, UnsupportedMessageType {
System.out.println("Initiator received message");
}
@Override
6-6
Chapter 6
Test the Example Application
@Override
public void onLogon(SessionID arg0) {
System.out.println("Initiator logon done"+arg0);
isLoggedOn=true;
}
//Optionally, you can implement the onLogout and toAdmin callback methods below.
//To implement them, see the QuickFix documentation: http://www.quickfixj.org.
@Override
public void onLogout(SessionID arg0){
//Notifies you when an FIX session is offline.
//The cause can be a logout, forced termination, or loss of network connection.
}
@Override
public void toAdmin(Message arg0, SessionID arg1) {
//Provides a look at the administrative messages sent from your FIX machine
//to another party. This method enables you to log messages. You can add
// fields to an adminstrative message before it is sent.
}
@Override
public void toApp(Message arg0, SessionID arg1) throws DoNotSend {
System.out.println("Initiator toApp");
}
}
initiator_sample.cfg
[default]
FileStorePath=/scratch/myusername/garage/quickfix/initiator/filestore
BeginString=FIX.4.2
UseDataDictionary=N
ConnectionType=initiator
[session]
SenderCompID=SAMPLESENDER
TargetCompID=SAMPLEACCEPTOR
SocketConnectHost=10.240.30.74
SocketConnectPort=9876
StartTime=00:00:00
EndTime=00:00:00
HeartBtInt=30
ReconnectInterval=5
runInitiator.bat
set QFJ_HOME=D:\installs\helios\eclipse\workspace\quickfix.ordertracker
set CP=%QFJ_HOME%/lib/mina-core-1.1.7.jar;%QFJ_HOME%/lib/slf4j-api-1.6.3.jar;
%QFJ_HOME%/lib/slf4j-jdk14-1.6.3.jar;%QFJ_HOME%/lib/slf4j-log4j12-1.6.3.jar;%QFJ_HOME
%/lib/quickfixj-all-1.5.2.jar;%QFJ_HOME%/lib/quickfixj-core-1.5.2.jar;%QFJ_HOME%/lib/
quickfixj-msg-fix40-1.5.2.jar;%QFJ_HOME%/lib/quickfixj-msg-fix41-1.5.2.jar;%QFJ_HOME
%/lib/quickfixj-msg-fix42-1.5.2.jar;%QFJ_HOME%/lib/quickfixj-msg-fix43-1.5.2.jar;
%QFJ_HOME%/lib/quickfixj-msg-fix44-1.5.2.jar;%QFJ_HOME%/lib/quickfixj-msg-
fix50-1.5.2.jar;%QFJ_HOME%/lib/quickfixj-msg-fixt11-1.5.2.jar;%QFJ_HOME%/dist/
quickfix.ordertracker.jar
6-7
Chapter 6
Test the Example Application
6-8
7
Event Processing Samples in Oracle
Stream Analytics
This chapter introduces the sample code provided with the Oracle Stream Analytics
installation and describes how to set up and use the code. You must have installed
Oracle Stream Analytics with the Examples check box checked.
This chapter covers the following topics:
• About the Samples
• Environment Setup
• Use Oracle Stream Analytics Visualizer with the Samples
• Increase the Performance of the Samples
• HelloWorld Example
• Oracle Continuous Query Language Example
• Oracle Spatial Example
• Foreign Exchange (FX) Example
• Signal Generation Example
• Event Record and Playback Example.
7-1
Chapter 7
About the Samples
The samples use Ant as their development tool. For details about Ant and installing it
on your computer, see http://ant.apache.org/.
See Run the HelloWorld Example from the helloworld Domain for details.
• The sample CQL domain is located in /Oracle/Middleware/my_oep/oep/ examples/
domains/cql_domain.
See Run the CQL Example for details.
• The sample Oracle Spatial domain is located in /Oracle/Middleware/my_oep/oep/
examples/domains/spatial_domain.
7-2
Chapter 7
Environment Setup
To build and run the sample source, your development environment must have Ant
installed. You must set ANT_HOME as follows:
export ANT_HOME=<path to Ant directory>
export PATH=${ANT_HOME}/bin:${PATH}
where host refers to the name of the computer hosting Oracle Stream Analytics. If it is
the same as the computer on which the browser is running you can use localhost.
Security is disabled for the HelloWorld application, so you can click Logon at the login
screen without entering a user name and password. For the FX and signal generation
samples, security is enabled, so use the following user name and password to log in:
Username: oepadmin
Password: welcome1
7-3
Chapter 7
Increase the Performance of the Samples
7-4
Chapter 7
HelloWorld Example
b. On UNIX:
• prompt> ./startwlevs.sh
After the server starts, you should see the following message printed to the output
about every second:
Message: HelloWorld - the current time is: 3:56:57 PM
7.5.2 Build and Deploy the HelloWorld Example from the Source
Directory
The HelloWorld sample source directory contains the Java source and other required
resources such as configuration XML files, that make up the HelloWorld application.
The build.xml Ant file contains targets to build and deploy the application to the
helloworld domain.
See also Description of the Ant Targets to Build Hello World.
Build and deploy the HelloWorld example from the source directory:
1. If the helloworld Oracle Stream Analytics server is not already running, follow the
procedure in Run the HelloWorld Example from the helloworld Domain to start the
server.
You must have a running server to successfully deploy the rebuilt application.
2. Open a new command window and change to the HelloWorld source directory,
located in /Oracle/Middleware/my_oep/oep/examples/source/applications/
helloworld.
3. Execute the all Ant target to compile and create the application JAR file:
prompt> ant all
4. Execute the deploy Ant target to deploy the application JAR file to Oracle Stream
Analytics:
prompt> ant -Daction=update deploy
7-5
Chapter 7
HelloWorld Example
Caution:
This target overwrites the existing helloworld application JAR file in the
domain directory.
You should see the following message printed to the output about every second:
Message: HelloWorld - the current time is: 3:56:57 PM
This message indicates that the HelloWorld example has been redeployed and is
running correctly.
7-6
Chapter 7
Oracle Continuous Query Language Example
For a detailed description of this file, and general information about programming
event types, see Defining and Using Event Types in Oracle Fusion Middleware
Developing Application for Oracle Event Processing .
• An XML file that configures the helloworldProcessor and helloworldOutputChannel
components. An important part of this file is the set of Oracle CQL rules that select
the set of events that the HelloWorld application processes. You are required to
include a Oracle CQL processor configuration file in your Oracle Event Processing
application, although the adapter and channel configuration is optional.
In the example, the file is called config.xml and is located in the ~/META-INF/wlevs
directory.
• A Java file that implements the helloworldBean component of the application, a
POJO that contains the business logic.
In the example, the file is called HelloWorldBean.java and is located in the
~/src/com/bea/wlevs/examples/helloworld directory.
• A MANIFEST.MF file that describes the contents of the OSGi bundle to be deployed to
Oracle Event Processing.
In the example, the MANIFEST.MF file is located in the META-INF directory.
The HelloWorld example uses a build.xml Ant file to compile, assemble, and deploy
the OSGi bundle; see Build and Deploy the HelloWorld Example from the Source
Directory for a description of this build.xml file if you also use Ant in your development
environment.
Note:
This sample might not start on a configuration of multiple coherence clusters
that have the same default multicast address and port numbers. The error
message contains text similar to ... has been attempting to join the
cluster at address /239.255.0.1:9100 with TTL 4 for 30 seconds without
success.
To get around this problem, specify unique addresses and ports to create a
distinct cluster.
7-7
Chapter 7
Oracle Continuous Query Language Example
Note:
For more information about the various components in the EPN, see the
other samples in this book.
7-8
Chapter 7
Oracle Continuous Query Language Example
2. Start Oracle Stream Analytics by executing the appropriate script with the correct
command line arguments:
a. On Windows:
• prompt> startwlevs.cmd
b. On UNIX:
• prompt> ./startwlevs.sh
The CQL application is now ready to receive data from the data feeds.
3. To simulate the data feed for the missing event query, open a new command
window.
4. Change to the /Oracle/Middleware/my_oep/oep/utils/load-generator.
5. Run the load generator using the orderData.prop properties file:
a. On Windows:
prompt> runloadgen.cmd orderData.prop
b. On UNIX:
prompt> ./runloadgen.sh orderData.prop
6. Change to the /Oracle/Middleware/my_oep/oep/utils/load-generator.
7. To simulate the data feed for the moving average query, open a new command
window
8. Run the load generator using the StockData.prop properties file:
a. On Windows:
prompt> runloadgen.cmd StockData.prop
b. On UNIX:
prompt> ./runloadgen.sh StockData.prop
9. To simulate the data feed for the cache query, you only need to run the example.
The load data is generated by Adaptor.java and the cache data is generated by
Loader.java. You can verify that data is flowing through by turning on statistics in
the Oracle Stream Analytics Visualizer Query Plan.
7-9
Chapter 7
Oracle Continuous Query Language Example
To build and deploy the CQL example from the source directory:
1. If the CQL Oracle Stream Analytics instance is not already running, follow the
procedure in Run the CQL Example to start the server.
You must have a running server to successfully deploy the rebuilt application.
2. Open a new command window and change to the CQL source directory, located
in /Oracle/Middleware/my_oep/oep/examples/source/applications/cql.
3. Execute the all Ant target to compile and create the application JAR file:
prompt> ant all
4. Execute the deploy Ant target to deploy the application JAR file to Oracle Stream
Analytics:
prompt> ant -Dusername=oepadmin -Dpassword=welcome1 -Daction=update deploy
Caution:
This target overwrites the existing CQL application JAR file in the domain
directory.
5. If the load generators required by the CQL application are not running, start them
as described in Run the CQL Example.
7-10
Chapter 7
Oracle Continuous Query Language Example
Consider a customer order workflow in which you have customer order workflow
events flowing into the Oracle Event Processing system.
In a valid scenario, you see events in the order that Table 7-1 lists:
You will create and test a query that detects the missing approval event and generates
an alert event:
• Create the missing event query:
• Test the missing event query:
where host refers to the name of the computer on which Oracle Event Processing
is running and port refers to the Jetty NetIO port configured for the server (default
value 9002).
The Logon screen displays.
7-11
Chapter 7
Oracle Continuous Query Language Example
3. In the Logon screen, enter the Username oepadmin, Password welcome1 and click
Login.
The Oracle Event Processing Visualizer dashboard displays.
7-12
Chapter 7
Oracle Continuous Query Language Example
7-13
Chapter 7
Oracle Continuous Query Language Example
7-14
Chapter 7
Oracle Continuous Query Language Example
You can use the Oracle CQL Query Wizard to construct an Oracle CQL query
from a template or from individual Oracle CQL constructs.
In this procedure, you are going to create an Oracle CQL query from a template.
9. Click the Templates tab.
The Templates tab displays.
7-15
Chapter 7
Oracle Continuous Query Language Example
10. Click and drag the Pattern Match Template from the Templates palette and drop
it anywhere in the Query Wizard canvas.
11. Double-click the SSource icon.
7-16
Chapter 7
Oracle Continuous Query Language Example
7-17
Chapter 7
Oracle Continuous Query Language Example
Using the Pattern tab, you will define the pattern expression that matches when
missed events occur. The expression is made in terms of named conditions that
you will specify on the Define tab in a later step.
16. Enter the following expression in the Pattern Expression field:
This pattern uses the Oracle CQL pattern quantifiers that Table 7-3 lists. Use the
pattern quantifiers to specify the allowed range of pattern matches. The one-
character pattern quantifiers are maximal (greedy). They attempt to match the
biggest quantity first. The two-character pattern quantifiers are minimal (reluctant).
They attempt to match the smallest quantity first.
17. Select orderid from the Partition By pull-down menu and click the Plus Sign
button to add this property to the PARTITION BY clause.
This ensures that Oracle Event Processing evaluates the missing event query on
each order.
18. Enter Orders in the Alias field.
7-18
Chapter 7
Oracle Continuous Query Language Example
This assigns an alias (Orders) for the pattern to simplify its use later in the query.
19. Click the Define tab.
You will now define each of the conditions named in the pattern clause as
Table 7-4 lists:
21. Click the Expression Builder button and configure the Expression Builder as
follows:
• In the Variables list, double-click eventType.
• In the Operands list, double-click =.
• After the = operand, enter the value 'C'.
7-19
Chapter 7
Oracle Continuous Query Language Example
7-20
Chapter 7
Oracle Continuous Query Language Example
25. Click the Expression Builder button and configure the Expression Builder:
7-21
Chapter 7
Oracle Continuous Query Language Example
29. Click the Expression Builder button and configure the Expression Builder :
7-22
Chapter 7
Oracle Continuous Query Language Example
7-23
Chapter 7
Oracle Continuous Query Language Example
7-24
Chapter 7
Oracle Continuous Query Language Example
• CustOrder.amount AS amount
34. Click the Expression Builder button and configure the Expression Builder:
38. Click the Expression Builder button and configure the Expression Builder:
7-25
Chapter 7
Oracle Continuous Query Language Example
7-26
Chapter 7
Oracle Continuous Query Language Example
7-27
Chapter 7
Oracle Continuous Query Language Example
• Select AlertEvent from the Select or Input Event Type pull-down menu.
• Select Orders from the Select a source pull-down menu.
44. Double-click orderid in the Properties list and select orderid from the Select or
Input Alias pull-down menu.
45. Click the Plus Sign button to add the property to the Generated CQL Statement.
46. Double-click amount in the Properties list and select amount from the Select or
Input Alias pull-down menu.
47. Click the Plus Sign button to add the property to the Generated CQL Statement.
48. Click in the Project Expression field and enter the value "Error - Missing
Approval" and select alertType from the Select or Input Alias pull-down menu.
49. Click the Plus Sign button to add the property to the Generated CQL Statement.
7-28
Chapter 7
Oracle Continuous Query Language Example
7-29
Chapter 7
Oracle Continuous Query Language Example
• Select Query.
• Enter Tracking as the Query Name.
54. Click Inject Rule.
7-30
Chapter 7
Oracle Continuous Query Language Example
7-31
Chapter 7
Oracle Continuous Query Language Example
7-32
Chapter 7
Oracle Continuous Query Language Example
You must have a running server to use the Oracle Event Processing Visualizer.
2. Invoke the following URL in your browser:
http://host:port/wlevs
where host refers to the name of the computer on which Oracle Event Processing
is running and port refers to the Jetty NetIO port configured for the server (default
value 9002).
The Logon screen displays.
3. In the Logon screen, enter the Username oepadmin and Password welcome1, and
click Login.
The Oracle Event Processing Visualizer dashboard displays.
7-33
Chapter 7
Oracle Continuous Query Language Example
7-34
Chapter 7
Oracle Continuous Query Language Example
7-35
Chapter 7
Oracle Continuous Query Language Example
You can use the Oracle CQL Query Wizard to construct an Oracle CQL query
from a template or from individual Oracle CQL constructs.
In this procedure, you are going to create an Oracle CQL view and query from
individual Oracle CQL constructs.
9. Click and drag an SSource icon (Stream Source) from the CQL Constructs palette
and drop it anywhere in the Query Wizard canvas as.
7-36
Chapter 7
Oracle Continuous Query Language Example
7-37
Chapter 7
Oracle Continuous Query Language Example
17. Click the SSource icon and drag to the Window icon to connect the Oracle CQL
constructs as follows:
7-38
Chapter 7
Oracle Continuous Query Language Example
7-39
Chapter 7
Oracle Continuous Query Language Example
The Query Wizard adds the expression to the Generated CQL Statement as
follows:
7-40
Chapter 7
Oracle Continuous Query Language Example
7-41
Chapter 7
Oracle Continuous Query Language Example
26. Click the Filter icon and drag to the Select icon to connect the Oracle CQL
constructs.
27. Double-click the Select icon.
7-42
Chapter 7
Oracle Continuous Query Language Example
32. Click the Select icon and drag to the Output icon to connect the Oracle CQL
constructs.
33. Double-click the Output icon.
• Select View.
• Configure View Name as StockVolGt1000.
• Delete the contents of the View Schema field.
You can let the Oracle Event Processing server define the view schema for
you.
7-43
Chapter 7
Oracle Continuous Query Language Example
7-44
Chapter 7
Oracle Continuous Query Language Example
where host refers to the name of the computer on which Oracle Event Processing
is running and port refers to the Jetty NetIO port configured for the server (default
value 9002).
The Logon screen displays.
7-45
Chapter 7
Oracle Continuous Query Language Example
3. In the Logon screen, enter the Username oepadmin and Password welcome1, and
click Login.
The Oracle Event Processing Visualizer dashboard displays.
7-46
Chapter 7
Oracle Continuous Query Language Example
7-47
Chapter 7
Oracle Continuous Query Language Example
You can use the Oracle CQL Query Wizard to construct an Oracle CQL query
from a template or from individual Oracle CQL constructs.
7-48
Chapter 7
Oracle Continuous Query Language Example
In this procedure, you are going to create an Oracle CQL view and query from
individual Oracle CQL constructs.
9. Click and drag an SSource icon (Stream Source) from the CQL Constructs palette
and drop it anywhere in the Query Wizard canvas as follows:
7-49
Chapter 7
Oracle Continuous Query Language Example
14. Click and drag a Window icon from the CQL Constructs palette and drop it
anywhere in the Query Wizard canvas as follows:
7-50
Chapter 7
Oracle Continuous Query Language Example
15. Click the SSource icon and drag to the Window icon to connect the Oracle CQL
constructs.
16. Double-click the Window icon.
• Select symbol in the Source Property List to add it to the Partition List.
• Select Partition as the Type.
• Select Row Based and enter 2 in the Row Based field.
18. Click Add Window.
The Query Wizard adds the sliding window to the Generated CQL Statement as
follows:
7-51
Chapter 7
Oracle Continuous Query Language Example
21. Click and drag a Select icon from the CQL Constructs palette and drop it
anywhere in the Query Wizard canvas as follows:
7-52
Chapter 7
Oracle Continuous Query Language Example
22. Click the Window icon and drag to the Select icon to connect the Oracle CQL
constructs.
23. Double-click the Select icon.
This is the source of moving average query: the view you created earlier (see
"Create a view source for the moving average query:").
25. Select MovingAvgEvent from the Target Event Type pull-down menu.
This is the output event your moving average query will produced. You will map
properties from the source events to this output event.
26. In the Source Properties list, select symbol.
7-53
Chapter 7
Oracle Continuous Query Language Example
In this case, you just want to map the source property symbol to output event
property symbol as is.
27. Click the pull-down menu next to the AS field and select symbol.
The source property is added to the project expression of the Generated CQL
Statement as follows:
7-54
Chapter 7
Oracle Continuous Query Language Example
7-55
Chapter 7
Oracle Continuous Query Language Example
In this case, you want to process the source property price before you map it to
the output event.
30. Click the Expression Builder button.
The AVG() function is wrapped around your selection in the Expression Builder field
as follows:
7-56
Chapter 7
Oracle Continuous Query Language Example
7-57
Chapter 7
Oracle Continuous Query Language Example
35. Click the pull-down menu next to the AS field and select movingAvgPrice.
The source property is added to the project expression of the Generated CQL
Statement as follows:
7-58
Chapter 7
Oracle Continuous Query Language Example
7-59
Chapter 7
Oracle Continuous Query Language Example
7-60
Chapter 7
Oracle Continuous Query Language Example
43. Click the Select icon and drag to the Output icon to connect the Oracle CQL
constructs.
44. Double-click the Output icon.
• Select Query.
• Enter MovingAverage as the Query Name.
7-61
Chapter 7
Oracle Continuous Query Language Example
7-62
Chapter 7
Oracle Continuous Query Language Example
7-63
Chapter 7
Oracle Spatial Example
7-64
Chapter 7
Oracle Spatial Example
For more information about data cartridges, see Oracle Fusion Middleware Oracle
CQL Language Reference for Oracle Stream Analytics.
7-65
Chapter 7
Oracle Spatial Example
2. Start Oracle Stream Analytics by executing the appropriate script with the correct
command line arguments:
a. On Windows:
• prompt> startwlevs.cmd
b. On UNIX:
• prompt> ./startwlevs.sh
Note:
You cannot run this example on one host and browse to it from another
host. This is a limitation of the Google API Key that the example uses
and is not a limitation of Oracle Stream Analytics.
7-66
Chapter 7
Oracle Spatial Example
Click the Bus Top Arrivals tab to view bus stop arrivals as follows:
4. Execute the Oracle Stream Analytics load generator to generate sample data:
a. Open a command prompt and navigate to /Oracle/Middleware/my_oep/utils/
load-generator.
7-67
Chapter 7
Oracle Spatial Example
b. On Windows, type:
• runloadgen.cmd bus_positions.prop
c. On UNIX, type:
• ./runloadgen.sh bus_positions.prop
For more information, see Description of the Ant Targets to Build Hello World.
Build and deploy the Oracle Spatial example from the source directory:
1. If the spatial_domain Oracle Stream Analytics instance is not already running,
follow the procedure in Run the Oracle Spatial Example to start the server.
You must have a running server to successfully deploy the rebuilt application.
2. Open a new command window and change to the Oracle Spatial source directory,
located in /Oracle/Middleware/my_oep/oep/examples/source/applications/ spatial.
3. Execute the all Ant target to compile and create the application JAR file:
prompt> ant all
4. Execute the deploy Ant target to deploy the application JAR file to Oracle Stream
Analytics:
7-68
Chapter 7
Oracle Spatial Example
Caution:
This target overwrites the existing Oracle Spatial application JAR file in
the domain directory.
• A component configuration file that configures the various components on the EPN
including the processor component of the application:
In the example, this file is called config.xml and is located in the ~/META-INF/wlevs
directory.
• Java files that implement:
– BusStopAdapter: Custom adapter component that generates bus stop positions
based on /Oracle/Middleware/my_oep/examples/domains/spatial_domain/
defaultserver/applications/spatial_sample/bus_stops.csv.
– OutputBean: POJO event bean component that logs a message for each insert,
delete, and update event to help visualize the relation offered by the
BusStopArrivalChannel
– OrdsHelper: Helper class that provides method getOrds to return the ordinates
from a JGeometry as a List of Double values.
7-69
Chapter 7
Foreign Exchange (FX) Example
For additional information about the Oracle Stream Analytics APIs referenced in
this POJO, see Java API Reference for Oracle Stream Analytics.
• A MANIFEST.MF file that describes the contents of the OSGi bundle that will be
deployed to Oracle Stream Analytics.
In the example, the MANIFEST.MF file is located in the META-INF directory.
The Oracle Spatial example uses a build.xml Ant file to compile, assemble, and
deploy the OSGi bundle; see Build and Deploy the Oracle Spatial Example for a
description of this build.xml file if you also use Ant in your development
environment.
In this scenario, three data feeds, simulated using the load generator, send a constant
pair of values from different parts of the world; the value pairs consist of a currency
pair, such as USDEUR for US dollar - European euro, and an exchange rate between
the two currencies. The fxMarketAmer, fxMarketAsia, and fxMarketEuro adapters receive
the data from the feeds, convert them into events, and pass them to the corresponding
FilterAmer, FilterAsia, and FilterEuro processors. Each Oracle CQL processor
performs an initial stale check to ensure that no event is more than 1 second old and
then a boundary check to ensure that the exchange rate between the two currencies is
within a current boundary. The Oracle CQL processor also only selects a specific
currency pair from a particular channel; for example, the server selects USDEUR from
the simulated American data feed, but rejects all other pairs, such as USDAUD
(Australian dollar).
After the data from each data feed provider passes this initial preparation phase, a
different Oracle CQL processor, called FindCrossRates, joins all events across all
7-70
Chapter 7
Foreign Exchange (FX) Example
providers, calculates the mid-point between the maximum and minimum rate, and then
applies a trader-specified spread. Finally, the Oracle CQL processor forwards the rate
to the POJO that contains the business code; in this example, the POJO simply
publishes the rate to clients.
The Oracle Stream Analytics monitor is configured to watch if the event latency in the
last step exceeds some threshold, such as no updated rates in a 30 second time-span,
and if there is too much variance between two consecutive rates for the same currency
pair. Finally, the last rate of each currency pair is forwarded to the Oracle Stream
Analytics http pub-sub server.
2. Start Oracle Stream Analytics by executing the appropriate script with the correct
command line arguments:
a. On Windows:
• prompt> startwlevs.cmd
b. On UNIX:
• prompt> ./startwlevs.sh
3. When prompted, enter wlevs for the user name and password.
The FX application is now ready to receive data from the data feeds.
4. To simulate an American data feed, open a new command window.
5. Change to the /Oracle/Middleware/my_oep/utils/load-generator directory.
6. Run the load generator using the fxAmer.prop properties file:
a. On Windows:
prompt> runloadgen.cmd fxAmer.prop
b. On UNIX:
prompt> ./runloadgen.sh fxAmer.prop
7. Repeat steps 4 - 6 to simulate an Asian data feed, using the fxAsia.prop
properties file:
a. On Windows:
prompt> runloadgen.cmd fxAsia.prop
b. On UNIX:
prompt> ./runloadgen.sh fxAsia.prop
7-71
Chapter 7
Foreign Exchange (FX) Example
These messages indicate that the Foreign Exchange example is running correctly.
The output shows the cross rates of US dollars to Japanese yen and US dollars to
UK pounds sterling.
7.8.2 Build and Deploy the Foreign Exchange Example from the
Source Directory
The Foreign Exchange (FX) sample source directory contains the Java source, along
with other required resources such as configuration XML files, that make up the FX
application. The build.xml Ant file contains targets to build and deploy the application
to the fx_domain domain, as described in Description of the Ant Targets to Build Hello
World.
Build and deploy the foreign exchange example from the source directory:
1. If the FX Oracle Stream Analytics instance is not already running, follow the
procedure in Run the Foreign Exchange Example to start the server.
You must have a running server to successfully deploy the rebuilt application.
2. Open a new command window and change to the FX source directory, located in /
Oracle/Middleware/my_oep/oep/examples/source/applications/fx.
3. Execute the all Ant target to compile and create the application JAR file:
7-72
Chapter 7
Foreign Exchange (FX) Example
Caution:
This target overwrites the existing FX application JAR file in the domain
directory.
5. If the load generators required by the FX application are not running, start them as
described in Run the Foreign Exchange Example.
After the server starts, you should see the following message printed to the output:
{crossRate=USDJPY, internalPrice=119.09934499999781}, {crossRate=USDGBP,
internalPrice=0.5031949999999915}, {crossRate=USDJPY,
internalPrice=117.73945624999783}
This message indicates that the FX example has been redeployed and is running
correctly.
• deploy: This target deploys the JAR file to Oracle Stream Analytics using the
Deployer utility.
7-73
Chapter 7
Signal Generation Example
events that were selected by the pre-processors, calculates an internal price for
the particular currency pair, and then calculates the cross rate. In the example, this
file is called spreader.xml and is located in the ~/META-INF/wlevs directory.
The summarizeResults Oracle CQL processor includes the Oracle CQL rule that
summarizes the results of the FindCrossRates processor. In the example, this file is
called SummarizeResults.xml and is located in the ~/META-INF/wlevs directory.
• An XML file that configures the PublishSummaryResults http pub-sub adapter. In the
example, this file is called PubSubAdapterConfiguration.xml and is located in the ~/
META-INF/wlevs directory.
• A Java file that implements the OutputBean component of the application, a POJO
that contains the business logic. This POJO prints out to the screen the events
that it receives, programmed in the onEvent method. The POJO also registers into
the event type repository the ForeignExchangeEvent event type.
In the example, the file is called OutputBean.java and is located in the ~/src/com/
oracle/cep/sample/fx directory.
For additional information about the Oracle Stream Analytics APIs referenced in
this POJO, see Java API Reference for Oracle Stream Analytics.
• A MANIFEST.MF file that describes the contents of the OSGi bundle that will be
deployed to Oracle Stream Analytics.
In the example, the MANIFEST.MF file is located in the META-INF directory.
The FX example uses a build.xml Ant file to compile, assemble, and deploy the
OSGi bundle; see Build and Deploy the Foreign Exchange Example from the
Source Directory for a description of this build.xml file if you also use Ant in your
development environment.
7-74
Chapter 7
Signal Generation Example
The application simulates a market data feed using the Oracle Stream Analytics load
generator utility; in this example, the load generator generates up to 10,000 messages
per second. The example includes an HTML dashboard which displays the matched
events along with the latencies; events consist of a stock symbol, a timestamp, and
the price.
The example demonstrates very low latencies, with minimum latency jitter under high
throughputs. Once the application starts running, the processor matches an average of
800 messages per second. If the application is run on the minimum configured system,
the example shows very low average latencies (30-300 microsecond, on average) with
minimal latency spikes (low milliseconds).
The example computes and displays latency values based on the difference between
a timestamp generated on the load generator and timestamp on Oracle Stream
Analytics. Computing valid latencies requires very tight clock synchronization, such as
1 millisecond, between the computer running the load generator and the computer
running Oracle Stream Analytics. For this reason, Oracle recommends running both
the load generator and Oracle Stream Analytics on a single multi-CPU computer
where they will share a common clock.
The example also shows how to use the Oracle Stream Analytics event caching
feature. In particular the single processor in the EPN sends events to both an event
bean and a cache.
The example also demonstrates how to use Oracle CQL queries.
2. Start Oracle Stream Analytics by executing the appropriate script with the correct
command line arguments:
a. On Windows:
• prompt> startwlevs.cmd
b. On UNIX:
• prompt> ./startwlevs.sh
3. When prompted, enter wlevs for the user name and password.
4. Wait until you see console messages like this:
<Apr 24, 2009 11:40:37 AM EDT> <Notice> <Server> <BEA-2046000> <Server STARTED>
Throughput (msg per second): 0. Average latency (microseconds): 0
Throughput (msg per second): 0. Average latency (microseconds): 0
Throughput (msg per second): 0. Average latency (microseconds): 0
7-75
Chapter 7
Signal Generation Example
The signal generation application is now ready to receive data from the data feeds.
Next, to simulate a data feed, you use a load generator programmed specifically
for the example.
5. 0pen a new command window.
6. Change to the /Oracle/Middleware/my_oep/examples/domains/
signalgeneration_domain/defaultserver/utils directory.
Replace host with the name of the computer on which Oracle Stream Analytics is
running; if it is the same computer as your browser, you can use localhost.
9. In the browser, click Start on the HTML page.
You should start seeing the events that match the Oracle CQL rules configured for
this example as follows:
7-76
Chapter 7
Signal Generation Example
7.9.2 Build and Deploy the Signal Generation Example from the
Source Directory
The signal generation sample source directory contains the Java source, along with
other required resources, such as configuration XML files, EPN assembly file, and
DOJO client JavaScript libraries, that make up the signal generation application. The
build.xml Ant file contains targets to build and deploy the application to the
signalgeneration_domain domain, as described in Description of the Ant Targets to
Build Signal Generation.
Build and deploy the signal generation example from the source directory:
1. If the signal generation Oracle Stream Analytics instance is not already running,
follow the procedure in Run the Signal Generation Example to start the server.
You must have a running server to successfully deploy the rebuilt application.
2. Open a new command window and change to the signal generation source
directory, located in /Oracle/Middleware/my_oep/oep/examples/source/
applications/signalgeneration.
3. Execute the all Ant target to compile and create the application JAR file:
prompt> ant all
4. Execute the deploy Ant target to deploy the application JAR file to the /Oracle/
Middleware/my_oep/examples/domains/signalgeneration_domain/defaultserver/
applications/signalgeneration directory:
Caution:
This target overwrites the existing signal generation application JAR file
in the domain directory.
5. If the load generator required by the signal generation application is not running,
start it as described in Run the Signal Generation Example.
6. Invoke the example dashboard as described in Run the Signal Generation
Example.
7-77
Chapter 7
Event Record and Playback Example
• An XML file that configures the processor component of the application; this file is
called config.xml and is located in the ~/META-INF/wlevs directory
The config.xml file configures the processor1 Oracle CQL processor, in particular
the Oracle CQL rules that verify whether the price of a security has fluctuated
more than two percent and whether a trend has occurred in its price.
• A Java file that implements the SignalgenOutputBean component of the application,
a POJO that contains the business logic. This POJO is an HttpServlet and an
EventSink. Its onEvent method consumes PercentTick and TrendTick event
instances, computes latency, and displays dashboard information.
In the example, the file is called SignalgenOutputBean.java and is located in the
~/src/oracle/cep/example/signalgen directory.
For general information about programming event sinks, see Handling Events with
Sources and Sinks in Oracle Fusion Middleware Developing Application for Oracle
Stream Analytics .
• A MANIFEST.MF file that describes the contents of the OSGi bundle that will be
deployed to Oracle Stream Analytics.
In the example, the MANIFEST.MF file is located in the META-INF directory
For more information about creating this file, as well as a description of creating
the OSGi bundle that you deploy to Oracle Stream Analytics, see Overview of
Application Assembly and Deployment in Oracle Fusion Middleware Developing
Application for Oracle Stream Analytics .
• A dashboard.html file in the main example directory; this HTML file is the example
dashboard that displays events and latencies of the running signal generation
application. The HTML file uses Dojo JavaScript libraries from http://
dojotoolkit.org/, located in the dojo directory.
For additional information about the Oracle Stream Analytics APIs referenced in
ForeignExchangeBuilderFactory, see Java API Reference for Oracle Stream Analytics.
The signal generation example uses a build.xml Ant file to compile, assemble, and
deploy the OSGi bundle; see Build and Deploy the Signal Generation Example from
the Source Directory for a description of this build.xml file if you also use Ant in your
development environment.
7-78
Chapter 7
Event Record and Playback Example
playback events from the store. The example uses the Oracle Stream Analytics-
provided default Berkeley database to store the events. The example also shows how
to configure a publishing HTTP pub-sub adapter as a stage in the event processing
network.
Figure 7-7 shows the event record and playback example Event Processing Network
(EPN). The EPN contains the components that make up the application and how they
fit together.
Figure 7-7 The Event Record and Playback Example Event Processing Network
7-79
Chapter 7
Event Record and Playback Example
The procedure then shows you how to use Oracle Stream Analytics Visualizer to start
the recording and playback of events at the simpleEventSource and eventStream
components, respectively. Finally, the procedure shows you how to use Oracle Stream
Analytics Visualizer to view the stream of events being published to a channel by the
playbackHttpPublisher adapter.
2. Start Oracle Stream Analytics by executing the appropriate script with the correct
command line arguments:
a. On Windows:
• prompt> startwlevs.cmd
b. On UNIX:
• prompt> ./startwlevs.sh
After the server starts, you should see the following message printed to the output:
SimpleEvent created at: 14:33:40.441
This message indicates that the Oracle Stream Analytics server started correctly
and that the simpleEventSource component is creating events.
3. Invoke the following URL in your browser:
http://host:port/wlevs
where host refers to the name of the computer on which Oracle Stream Analytics
is running and port refers to the Jetty NetIO port configured for the server (default
value 9002).
The Logon screen displays.
7-80
Chapter 7
Event Record and Playback Example
4. In the Logon screen, enter the Username oepadmin and Password welcome1, and
click Login.
The Oracle Stream Analytics Visualizer dashboard displays.
7-81
Chapter 7
Event Record and Playback Example
The DataSet Name field contains the value of the record-parameters child element
dataset-name element from the simpleEventSource adapter application configuration
file /Oracle/Middleware/my_oep/examples/domains/recplay_domain/defaultserver/
applications/recplay/config.xml.
<adapter>
<name>simpleEventSource</name>
<record-parameters>
<dataset-name>recplay_sample</dataset-name>
<event-type-list>
<event-type>SimpleEvent</event-type>
</event-type-list>
<batch-size>1</batch-size>
<batch-time-out>10</batch-time-out>
</record-parameters>
</adapter>
7. At the bottom of the Record tab, click Start.
An Alert dialog displays.
8. Click OK.
7-82
Chapter 7
Event Record and Playback Example
7-83
Chapter 7
Event Record and Playback Example
You should see the following messages being printed to the command window
from which you started Oracle Stream Analytics server to indicate that both
original events and playback events are streaming through the EPN:
SimpleEvent created at: 14:33:11.501
Played back: Original time=14:15:23.141 Playback time=14:33:11.657
You can further configure the playback parameters, such as the recorded time
period for which you want playback events and the speed that they are played
back, by updating the appropriate field and clicking Change Parameters. You
must restart the playback after changing any playback parameters.
13. To view the events that the playbackHttpPublisher adapter is publishing to a
channel, follow these steps:
a. In the top panel, select Viewstream.
The Viewstream window displays.
7-84
Chapter 7
Event Record and Playback Example
Build and deploy the event record/playback example from the source directory:
1. If the record/playback Oracle Stream Analytics instance is not already running,
follow the procedure in Run the Event Record/Playback Example to start the
server. You must have a running server to successfully deploy the rebuilt
application.
2. Open a new command window and change to the record/playback source
directory, located in /Oracle/Middleware/my_oep/oep/examples/source/
applications/recplay.
3. Execute the all Ant target to compile and create the application JAR file:
prompt> ant all
4. Execute the deploy Ant target to deploy the application JAR file to the /Oracle/
Middleware/my_oep/examples/domains/recplay_domain/defaultserver/applications/
recplay directory:
Caution:
This target overwrites the existing event record/playback application JAR
file in the domain directory.
After an application redeploy message, you should see the following message
printed to the output about every second:
SimpleEvent created at: 14:33:40.441
This message indicates that the record and playback example has been
redeployed and is running correctly.
5. Follow the instructions in Run the Event Record/Playback Example, starting at
step 4, to invoke Oracle Stream Analytics Visualizer and start recording and
playing back events.
7-85
Chapter 7
Event Record and Playback Example
• all: This target cleans, compiles, and puts the application into a JAR file called
com.bea.wlevs.example.recplay_12.1.2.0_0.jar, and places the generated JAR file
into a dist directory below the current directory.
• deploy: This target deploys the JAR file to Oracle Stream Analytics using the
Deployer utility.
• A Java file that implements the recplayEventSink event bean of the application,
which is an event sink that receives both realtime events from the
simpleEventSource adapter as well as playback events.
7-86
Chapter 7
Event Record and Playback Example
For more information about creating this file, as well as a description of creating
the OSGi bundle that you deploy to Oracle Stream Analytics, see Overview of
Application Assembly and Deployment.
The record/playback example uses a build.xml Ant file to compile, assemble, and
deploy the OSGi bundle; see Build and Deploy the Event Record/Playback Example
for a description of this build.xml file if you also use Ant in your development
environment.
7-87