Oracle® Fusion Middleware Release Notes 11g Release 1 (11.1.1) for Linux x86-64 Part Number E14770-05 |
|
|
View PDF |
This chapter describes issues associated with Oracle Complex Event Processing (Oracle CEP). It includes the following topics:
This section describes general issue and workarounds. It includes the following topics:
Section 24.1.3, "New and Deprecated Options in the Deployer Tool"
Section 24.1.4, "Changes in Management, Monitoring, and JMX"
Section 24.1.5, "Using stopwlevs.sh With Multiple Servers on the Same Host"
Section 24.1.6, "Monitor Service may Underestimate Latency For Application-Timestamped Channels"
Section 24.1.8, "Variable Duration Non-Event Detection is not Supported in This Release"
Section 24.1.9, "JMSAdapterMBean Getter Methods for New Connection and User and Password"
Table 24-1 lists Java API deprecated in 11g Release 1 (11.1.1) and the replacement API, if any.
Table 24-1 Deprecated Java API
Deprecated API | Replacement API |
---|---|
|
|
|
|
|
|
|
|
|
|
Table 24-2 lists Oracle CEP schema deprecated in 11g Release 1 (11.1.1) and the replacement schema, if any.
Table 24-2 Deprecated Oracle CEP Schema
Deprecated Schema | Deprecated in Assembly File? | Deprecated in Component Configuration File? | Replacement Schema |
---|---|---|---|
|
Yes |
Yes |
|
|
Yes |
N/A |
|
|
Yes |
N/A |
|
|
Yes |
N/A |
None. |
|
Yes |
N/A |
None. |
|
N/A |
Yes |
None. |
|
N/A |
Yes |
None. |
|
N/A |
Yes |
None. |
For information on deprecated Oracle CQL syntax, see:
The programming model for adapters has changed as follows:
Outbound Adapters
Adapters can now also be outbound; previously they were only inbound.
Lifecycle Callback Methods for Adapters
Spring tags for adapters now include attributes for setting lifecycle callback methods via the EPN assembly file.
Runnable Adapters
For adapters that want to run in a thread, their Java class should now implement com.bea.wlevs.ede.api.RunnableBean
.
Adapter Factories
Programmers are no longer required to create an adapter factory when creating adapters. You only need to create an adapter factory if you want to share adapters among applications.
Publishing Adapter Providers
Adapter providers are factories for adapters that are published through the OSGi service registry.
Previously, the only way of advertising adapter providers was to use Spring-DM only, like this:
<osgi:service interface="com.bea.wlevs.ede.api.AdapterFactory" ref="myBean"> <osgi:service-properties> <entry key="type" value="SocketAdapterType"/> </osgi:service-properties> </osgi:service>
However, Spring-DM does not support exporting and importing an OSGi service in the same application so the above approach is deprecated.
Now, you should declare providers with the wlevs:factory
tag like this:
<wlevs:factory provider-name="SocketAdapterType" ref="myBean">
This will work whether the adapters are in the same application or not.
Note that if your adapters and providers are collocated (both in the same application) using a provider is optional; you could just instantiate the adapter directly.
Failure to make this change may result in an application that fails to start and eventually times out.
StockTick Event Type Replaced by OracleStockTick
When using the loadgen adapter, note that the StockTick
event is now named OracleStockTick
.
The -start
and -stop
commands of the Deployer tool have been deprecated.
When using the -install
command to install an application, Oracle CEP automatically starts it after all internal initialization tasks have completed. Subsequently, if you stop and start the Oracle CEP server instance, the application is automatically stopped and started, respectively.
The Deployer tool has two new options: -suspend
and -resume
. Users should use -suspend
to suspend a currently running application, and -resume
for it to resume running.
"Deployer Command-Line Reference" in the Oracle CEP Administrator's Guide.
The management framework of Oracle CEP has been overhauled in this release.
Oracle CEP no longer supports the JRMP protocol. Instead, JMX clients must use the more secure MSA protocol for both local and remote access to the Oracle CEP JMX server. When you connect to the Oracle CEP JMX server that is running on localhost
or on a remote host, you must always use the JMX URL service:jmx:msarmi://
HOST-NAME
:
PORT
/jndi/jmxconnector
so that you are always using the MSA connector (where HOST-NAME
is either localhost
or the name of the remote host and PORT
is the Oracle CEP server JNDI port).
For more information, see:
"Accessing the Oracle CEP JMX Server" in the Oracle CEP Administrator's Guide
"Configuring JMX" in the Oracle CEP Administrator's Guide
Consider a scenario where you start two servers on the same host, for example, with server 1 listening on port 9002 and server 2 listening on port 9022. If you then use stopwlevs.sh
in the server 1 domain directory, the server listening on port 9002 is stopped. If you then use stopwlevs.sh
in the server 2 domain directory, the stop operation fails due to connection reset error.
Workaround: use the stopwlevs.sh
command line argument -url
or -listenPort
to specify a port other than 9002.
The monitor service may underestimate the latency time of events that are being processed through the CQL processor when application-timestamped channels are being used and is-totally-ordered is not enabled.
When you connect to Oracle CEP server using JConsole (with or without the wlevsjconsole.sh
script), JConsole may throw a java.lang.NullPointerException
.
Workaround: click OK in the exception dialog box and proceed. The exception does not affect the JMX connection or Oracle CEP server.
Fixed duration non-event pattern detection is supported in 11g Release 1 (11.1.1). When you create a query for fixed duration non-event detection, you may use the DURATION
clause with constant value and time unit, such as DURATION 5 SECONDS
, or just a constant value such as DURATION 5
.
Variable duration non-event pattern detection is not supported in 11g Release 1 (11.1.1). That is, you may not use the DURATION
clause with an arbitrary arithmetic expression, such as DURATION c1+4
.
Recurring non-event pattern detection is supported in 11g Release 1 (11.1.1) but only for the fixed duration case. That is, you may use a DURATION
clause with a MULTIPLES OF
clause but only for a duration that is a constant value.
For documentation errata related to this issue, see Section 24.3.7, "Variable Duration Non-Event Detection is not Supported in This Release".
The following methods have been added to com.bea.wlevs.management.configuration.JMSAdapterMBean
:
getConnectionUser
getConnectionPassword
getConnectionEncryptedPassword
The following attributes have been added to the wlevs_application_config.xsd
element jms-adapter
:
connection-user
connection-password
connection-encrypted-password
When Oracle CEP acquires the JNDI InitialContext
, it uses the user
and password
(or encrypted-password
) settings.
When Oracle CEP calls the createConnection
method on the javax.jms.ConnectionFactory
to create a connection to the JMS destination (JMS queue or topic), it uses the connection-user
and connection-password
(or connection-encrypted-password
) settings, if configured. Otherwise, Oracle CEP uses the user
and password
(or encrypted-password
) settings.
You can use the connection-user
and connection-password
(or connection-encrypted-password
) settings in applications where one security provider is used for JNDI access and a separate security provider is used for JMS access.
This section describes configuration issues and their workarounds. It includes the following topics:
Section 24.2.1, "Accessing Signal Generation Dashboard With Firefox Version 3.0 on Windows"
Section 24.2.2, "Starting a Server in a Domain Without Deployed Applications"
Section 24.2.4, "Starting Oracle CEP Visualizer With Firefox"
Section 24.2.5, "Uploading Files Using Oracle CEP Visualizer With Firefox and SSL"
Section 24.2.6, "A Channel Cannot be a Foreign Stage When Connected to an Oracle CQL Processor"
Section 24.2.7, "Exceptions Thrown When Using Oracle CEP Visualizer with FireFox"
Section 24.2.9, "Configuring Oracle CEP Native Clustering Using IPv6 on Linux"
Section 24.2.10, "Multi-Byte Characters are not Supported by loadgen"
When accessing the signal generation example dashboard (at URL http://localhost:9002/signalgeneration/dashboard.html
) using the Firefox browser version 3.0 on Windows, you will get an error when you click Start.
Workaround: use Internet Explorer version 7 to access the signal generation example dashboard.
When you start a server in a domain with no deployed applications, the Server STARTED
message may not appear in the command window from which you ran the server start script, even though the server has successfully started.
Active VPN software is known to have unpredictable behavior on multicast traffic. Additionally, having both Cisco VPN and Nortel VPN installed breaks multicast traffic.
When using Oracle CEP Visualizer with the Firefox browser (version 3.0, SSL, and JDK 1.6), the first time you access a Oracle CEP Visualizer page it will render slowly, sometimes up to 30 seconds.
When using Oracle CEP Visualizer, you may get an error if you try to upload a file using the Firefox browser and SSL.
This is a known problem (http://bugs.adobe.com/jira/browse/FP-226
) with Adobe Flex that affects Oracle CEP Visualizer.
If a channel is connected to an Oracle CQL processor, it cannot be a foreign stage.
When using Oracle CEP Visualizer with FireFox:
Do not set the Jetty scratch directory to a path with a space in it. Doing so will cause FileNotFoundException
.
Ignore EOFException
thrown on the server side; these exceptions will not cause client side failure.
The Oracle CEP IDE for Eclipse uses Eclipse 3.3, which is incompatible with required FireFox 3 libraries on Linux. In this case, Eclipse will crash on startup with a JVM core dump and error message like this:
# An unexpected error has been detected by Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00bc80ac, pid=18044, tid=3086637584 # # Java VM: Java HotSpot(TM) Client VM (11.3-b02 mixed mode, sharing linux-x86) # Problematic frame: # C [libc.so.6+0x710ac] memcpy+0x1c # # An error report file with more information is saved as: # /usr/local/bt/workspace/testruntime/eclipse/hs_err_pid18044.log
Workaround: perform the following procedure.
Change to the root user on your Linux machine.
Prevent Eclipse from loading the libc.so
library noted in the core dump error message:
mv libc.so libc.so.orig
Note:
This will disable FireFox 3 on this machine. To use FireFox 3, you must change the name of this library back tolibc.so
.Follow the instructions outlined in the Eclipse Linux crash support Wiki page:
In particular, ensure that the JVM you are using with Eclipse is:
explicitly pointed to in the eclipse.ini
file, and
JDK 1.6 or higher
When using Oracle CEP native clustering on Linux with IPv6, you may see an error like the one shown in Example 24-1 after restarting a member of a cluster.
Example 24-1 Oracle CEP Server Log evs4j Error
<Error> <evs4j> <BEA-2049005> <The cluster member 3 is considered to have failed>
Workaround: perform the following procedure:
Using the editor of your choice, open the startwlevs.sh
script for the affected Oracle CEP sever.
The startwlevs.sh
server start script is located in the server directory under the main domain directory. For example, the default server directory of the HelloWorld domain is located in ORACLE_CEP_HOME
/ocep_11.1/samples/domains/helloworld_domain/defaultserver
, where ORACLE_CEP_HOME
refers to the main Oracle CEP installation directory, such as /oracle_cep
.
Edit the startwlevs.sh
script to add the -Djava.net.preferIPv4Stack=true
property to the java
command line:
"$JAVA_HOME/bin/java" $JVM_ARGS $DEBUG_ARGS -Djava.net.preferIPv4Stack=true -Dwlevs.home="$USER_INSTALL_DIR" -Dbea.home="$BEA_HOME" -jar "${USER_INSTALL_DIR}/bin/wlevs.jar" $ARGS
Save and close the startwlevs.sh
script.
Start the affected Oracle CEP server using the modified startwlevs.sh
script.
The loadgen utility supports only ASCII characters. It does not support multi-byte character sets.
The passwords for the keystore and the alias for the SSL private key must be the same. If they are not, the Oracle CEP Server will not start.
For more information, see Section 24.3.12, "Oracle CEP Server Will not Start if the Keystore and Private Key Passwords are Different".
This section describes documentation errata. It includes the following topics:
Section 24.3.2, "Reference to Additional Oracle CEP Samples Missing"
Section 24.3.3, "Colt Aggregate Function Example Output Incomplete"
Section 24.3.4, "User-Defined Single Row Function Does not Implement an Interface"
Section 24.3.7, "Variable Duration Non-Event Detection is not Supported in This Release"
Section 24.3.11, "Avoiding a Single Point of Failure for Oracle CEP Visualizer Access"
Section 24.3.13, "Colt Functions DurbinWatson and sampleStandardDeviation are not Supported"
Section 24.3.14, "Oracle CQL Built-In Function Names Must be Lower Case"
Section 24.3.15, "Adapter Example Source Uses Deprecated API"
The installer file names in the following sections are incorrect:
"Installing Oracle CEP in Graphical Mode" in the Oracle CEP Getting Started
"Installing Oracle CEP in Console Mode" in the Oracle CEP Getting Started
Table 24-3 lists the correct installer file names for each supported platform.
"Overview of the Samples Provided in the Distribution Kit" in the Oracle CEP Getting Started should include the following information:
"Additional Oracle CEP sample code can be found at http://www.oracle.com/technology/sample_code/products/event-driven-architecture
".
"Functions: Colt Aggregate" in the Oracle CEP CQL Language Reference contains incomplete example output for the following functions:
AUTOCORRELATION
DURBINWATSON
HARMONICMEAN
SAMPLESTANDARDDEVIATION
TRIMMEDMEAN
The introductory paragraph in "How to Implement a User-Defined Single-Row Function" in the Oracle CEP CQL Language Reference reads:
"You implement a user-defined single-row function by implementing a Java class that implements the SingleElementFunction interface."
It should read:
"You implement a user-defined single-row function by implementing a Java class that provides a public constructor and a public method that is invoked to execute the function."
Step 2 of this procedure should read:
"Compile the user-defined function Java implementation class and register the class in your Oracle CEP application assembly file as Example 24-2 shows.
Example 24-2 Single-Row User Defined Function for an Oracle CQL Processor
<wlevs:processor id="testProcessor"> <wlevs:listener ref="providerCache"/> <wlevs:listener ref="outputCache"/> <wlevs:cache-source ref="testCache"/> <wlevs:function function-name="mymod" exec-method="execute" /> <bean class="com.bea.wlevs.example.function.MyMod"/> </wlevs:function> </wlevs:processor>
Specify the method that is invoked to execute the function using the wlevs:function
element exec-method
attribute. This method must be public and must be uniquely identifiable by its name (that is, the method cannot have been overridden).
For more information, see "wlevs:function" in the Oracle CEP IDE Developer's Guide for Eclipse."
"Viewing and Changing the Configuration of a Stage" in the Oracle CEP Visualizer User's Guide is missing a topic on the JMS Adapter stage.
"Configuring Severity for an Individual Module" in the Oracle CEP Administrator's Guide is missing some of the valid logging component name constants you can use. Table 24-4 provides the complete list.
Table 24-4 Logging Component Name Constants
Component Name Constant | Description |
---|---|
|
Applies to log messages from adapter instances running on the Oracle CEP server. |
|
Applies to log messages from caching systems and cache instances running on the Oracle CEP server. |
|
Applies to log messages from channels running on the Oracle CEP server. |
|
Applies to log messages from Oracle CQL processors running on the Oracle CEP server. |
|
Applies to log messages from EPL processors running on the Oracle CEP server. |
|
Applies to log messages from the Event-Driven Environment, the Oracle CEP server event-dispatching infrastructure. |
|
When set to At the <May 26, 2009 5:53:49 PM PDT> <Info> <EventTrace> <BEA-000000> <Application [helloworld], Stage [helloworldOutputChannel] received insert event> At the <May 26, 2009 6:02:34 PM PDT> <Debug> <EventTrace> <BEA-000000> <Application [helloworld], Stage [helloworldOutputChannel] received insert event [HelloWorldEvent: HelloWorld - the current time is: 6:02:34 PM]> |
|
Applies to log messages from Oracle CEP server and application lifecycle operations. |
|
Applies to log messages from Oracle CEP server general JMX-related management API operations. |
|
Applies to log messages from the Oracle CEP server monitoring service. |
|
Applies to log messages from Oracle CEP server event recording and playback operations. |
|
Applies to log messages from Spring container operations. |
|
Applies to log messages from stream instances running on the Oracle CEP server. |
"DURATION Clause" in the Oracle CEP CQL Language Reference describes using the DURATION
clause for non-event detection. This section should distinguish between the following:
For fixed duration non-event detection, you use the DURATION
clause with a constant value and time unit or just a constant value.
For variable duration non-event detection, you use the DURATION
clause with an arbitrary arithmetic expression.
For recurring non-event detection, you use the DURATION
clause with a MULTIPLES OF
clause.
Fixed duration non-event pattern detection is supported in 11g Release 1 (11.1.1). When you create a query for fixed duration non-event detection, you may use the DURATION
clause with constant value and time unit, such as DURATION 5 SECONDS
, or just a constant value such as DURATION 5
.
Variable duration non-event pattern detection is not supported in 11g Release 1 (11.1.1). That is, you may not use the DURATION
clause with an arbitrary arithmetic expression, such as DURATION c1+4
.
Recurring non-event pattern detection is supported in 11g Release 1 (11.1.1) but only for the fixed duration case. That is, you may use a DURATION
clause with a MULTIPLES OF
clause but only for a duration that is a constant value.
The title of "Non-Event Detection" in the Oracle CEP CQL Language Reference should read "Fixed Duration Non-Event Detection".
The following examples in "DURATION Clause" in the Oracle CEP CQL Language Reference are incorrect and should read as shown below:
Example 15-8 "MATCH_RECOGNIZE with DURATION Clause Stream Output"
Timestamp Tuple Kind Tuple11000: + 10,8825000: + 10,38000: + 10,1850000: + 10,1962000: + 10,
Example 15-11 "MATCH_RECOGNIZE with DURATION MULTIPLES OF Clause Stream Output"
Timestamp Tuple Kind Tuple 11000: + 10,88,637 25000: + 10,, 38000: + 10,18,18 48000: + 10,19,37 58000: + 10,19,37 68000: + 10,20,57 82000: + 10,, 92000: + 10,,102000: + 10,,112000: + 10,,
The paragraph after Example 15-8:
"Now the further tuples that arrive until 11000 all match B
. Since the duration is 10 we output a match at time 1000+10000=11000
. Note that the last of the tuples that match B
is chosen (the one with the value 15) since the greedy quantifier *
in the pattern regular expression AB*
suggests as many B
matches as possible should be matched. Since the sequence of tuples from 1000 through 11000 match the pattern AB*
and nothing else a match is reported at 11000."
Should read:
"Since the duration is 10 we output a match as soon as input at time 1000+10000=11000
is received (the one with the value 12). Since the sequence of tuples from 1000 through 9000 match the pattern AB*
and nothing else a match is reported as soon as input at time 11000 is received."
"Comparison Conditions" in the Oracle CEP CQL Language Reference refers to the deprecated outer join operator (+)
. Oracle recommends that you not use the (+)
join operator. Use the LEFT OUTER JOIN
and RIGHT OUTER JOIN
syntax described below.
"Outer Joins" in the Oracle CEP CQL Language Reference refers to the deprecated outer join operator (+)
. This section should read as follows:
An outer join extends the result of a simple join. An outer join returns all rows that satisfy the join condition and also returns some or all of those rows from one table for which no rows from the other satisfy the join condition.
Example 24-3 shows how to create a query q5
that uses a left outer join between streams S0
, with schema (c1 integer, c2 float)
, and S1
, with schema (c1 integer, c2 float)
.
Example 24-3 Outer Joins
<query id="q5"><![CDATA[ SELECT a.c1+b.c1 FROM S0[range 5] AS a LEFT OUTER JOIN S1[range 3] AS b ON b.c2 = a.c2 WHERE b.c2 > 3 ]]></query>
Use the ON
clause to specify a join condition. Doing so lets you specify join conditions separate from any search or filter conditions in the WHERE
clause.
You can perform the following types of outer join:
To write a query that performs an outer join of streams A and B and returns all stream elements from A (a left outer join), use the LEFT OUTER JOIN
syntax in the FROM
clause as Example 24-4 shows. For all stream elements in A that have no matching stream elements in B, Oracle CEP returns null for any select list expressions containing stream elements of B.
To write a query that performs an outer join of streams A and B and returns all stream elements from B (a right outer join), use the RIGHT OUTER JOIN
syntax in the FROM
clause as Example 24-5 shows. For all stream elements in B that have no matching stream elements in A, Oracle CEP returns null for any select list expressions containing stream elements of A.
"Installing Oracle CEP" in the Oracle CEP Getting Started is missing information on using the patch client.
For more information, see Oracle Smart Update Installing Patches and Maintenance Packs.
The procedures in "Creating an Oracle CEP Multi-Server Domain Using Oracle CEP Native Clustering" in the Oracle CEP Administrator's Guide and "Creating an Oracle CEP Multi-Server Domain Using Oracle Coherence" in the Oracle CEP Administrator's Guide contain steps that read:
"To improve performance, consider disabling Oracle CEP Visualizer access on all but one server in the domain."
Should read:
"To avoid a single point of failure, consider enabling Oracle CEP Visualizer on a small subset of n
machines in the domain. Note that enabling Oracle CEP Visualizer on a given Oracle CEP Server may impact the performance of the server depending on the Oracle CEP Visualizer workload."
"Creating an Oracle CEP Standalone-Server Domain Using the Configuration Wizard in Graphical Mode" in the Oracle CEP Administrator's Guide step 11 reads:
"Enter and confirm the password for the Oracle CEP domain identity keystore.
By default, the password for the certificate private key will be the same as the identity keystore; if you want it to be different, uncheck Use Keystore Password and enter the private key password."
Should read:
"Enter and confirm the password for the Oracle CEP domain identity keystore.
By default, the password for the certificate private key will be the same as the identity keystore; the Oracle CEP Server will not start if otherwise. Do not uncheck Use Keystore Password and do not enter a private key password."
"Configuring SSL to Secure Network Traffic" in the Oracle CEP Administrator's Guide is missing the following procedure:
By default, the Configuration Wizard creates a default key-store certificate file, called evsidentity.jks
, in the DOMAIN_DIR
/
servername
/ssl
directory; its password is the same as that entered when creating a server with the Configuration Wizard. Optionally, you can manually create your own keystore.
To create a key-store manually:
Use the JDK keytool command to generate a keystore:
keytool -genkey -alias evsidentity -keyalg RSA -validity 10958 -keystore evsidentity.jks -keysize 1024
Enter the keystore password, as prompted:
Enter keystore password:
Enter the keystore attributes, as prompted:
What is your first and last name? [Unknown]: CEP What is the name of your organizational unit? [Unknown]: SOA What is the name of your organization? [Unknown]: ORACLE What is the name of your City or Locality? [Unknown]: SF What is the name of your State or Province? [Unknown]: CA What is the two-letter country code for this unit? [Unknown]: US Is CN=CEP, OU=SOA, O=ORACLE, L=SF, ST=CA, C=US correct? [no]: y
When prompted for a key password, do not enter a password; just press RETURN
:
Enter key password for <evsidentity> (RETURN if same as keystore password):
Note:
The Oracle CEP Server will not start unless the password for certificate private key is the same as the password for the identity keystore.Using your favorite XML editor, open the Oracle CEP server config.xml
file.
By default, the Configuration Wizard creates the config.xml
file in the ORACLE_CEP_HOME
/user_projects/domains/
DOMAIN_DIR
/
servername
/config
directory, where ORACLE_CEP_HOME
refers to the Oracle CEP installation directory (such as d:/oracle_cep
), DOMAIN_DIR
refers to the domain directory (such as my_domain
), and servername
refers to the server instance directory (such as server1
).
Configure the ssl
element.
Example 24-6 shows the default ssl
element the Configuration Wizard creates.
Example 24-6 Default ssl Element
<ssl> <name>sslConfig</name> <key-store>KEYSTORE_PATH</key-store> <key-store-pass> <password>PASSWORD</password> </key-store-pass> <key-store-alias>KEYSTORE_ALIAS</key-store-alias> <key-manager-algorithm>SunX509</key-manager-algorithm> <ssl-protocol>TLS</ssl-protocol> <enforce-fips>false</enforce-fips> <need-client-auth>false</need-client-auth> </ssl>
Where:
KEYSTORE_PATH
is the file path to the keystore file (the file name is from the -keystore
argument to the keytool command).
PASSWORD
is the cleartext keystore password.
KEYSTORE_ALIAS
is the keystore alias (from the -alias
argument to the keytool command).
Save and close the config.xml
file.
Encrypt the cleartext password in the key-store-pass
element password
child element of the config.xml
file by using the encryptMSAConfig
utility.
See "The encryptMSAConfig Command-Line Utility" in the Oracle CEP Administrator's Guide.
Oracle CEP does not support Colt functions DurbinWatson
and sampleStandardDeviation
.
The following sections should be omitted:
"DURBINWATSON" in the Oracle CEP CQL Language Reference
"SAMPLESTANDARDDEVIATION" in the Oracle CEP CQL Language Reference
In the following sections, all built-in function names should be lower case:
"Functions: Single-Row" in the Oracle CEP CQL Language Reference
"Functions: Aggregate" in the Oracle CEP CQL Language Reference
"Functions: Colt Single-Row" in the Oracle CEP CQL Language Reference
"Functions: Colt Aggregate" in the Oracle CEP CQL Language Reference
"Functions: java.lang.Math" in the Oracle CEP CQL Language Reference
In "Event Sources and Event Sinks" in the Oracle CEP IDE Developer's Guide for Eclipse, should use the API StreamSink
and RelationSink
and StreamSource
and RelationSource
instead of the deprecated EventSource
and EventSink
API.
Similarily, the following areas of the Oracle CEP IDE Developer's Guide for Eclipse
should also use the API StreamSink
and RelationSink
and StreamSource
and RelationSource
instead of the deprecated EventSource
and EventSink
API:
Section 24.3.15.1, "Implementing an Adapter or Event Bean as an Event Source"
Section 24.3.15.2, "Implementing an Adapter or Event Bean as an Event Sink"
"Implementing an Adapter or Event Bean as an Event Source" in the Oracle CEP IDE Developer's Guide for Eclipse should read as follows:
This section describes how to create an inbound adapter that acts as an event source because it receives incoming data and generates events that it sends to the next component in the EPN. Because event beans are functionally the same, the guidelines also apply to programming event beans that act as event sources.
The inbound adapter class typically reads the stream of incoming data, such as from a market data feed, converts it into an Oracle CEP event type that is understood by the rest of the application, and sends the event to the next component in the network.
The following example shows the adapter class of the HelloWorld
sample; see the explanation after the example for coding guidelines that correspond to the Java code in bold.
package com.bea.wlevs.adapter.example.helloworld; import java.text.DateFormat; import java.util.Date; import com.bea.wlevs.ede.api.RunnableBean; import com.bea.wlevs.ede.api.StreamSender; import com.bea.wlevs.ede.api.StreamSource; import com.bea.wlevs.event.example.helloworld.HelloWorldEvent; public class HelloWorldAdapter implements RunnableBean, StreamSource { private static final int SLEEP_MILLIS = 300; private DateFormat dateFormat; private String message; private boolean suspended; private StreamSender eventSender; public HelloWorldAdapter() { super(); dateFormat = DateFormat.getTimeInstance(); } public void run() { suspended = false; while (!isSuspended()) { // Generate messages forever... generateHelloMessage(); try { synchronized (this) { wait(SLEEP_MILLIS); } } catch (InterruptedException e) { e.printStackTrace(); } } } public void setMessage(String message) { this.message = message; } private void generateHelloMessage() { String message = this.message + dateFormat.format(new Date()); HelloWorldEvent event = new HelloWorldEvent(); event.setMessage(message); eventSender.sendInsertEvent(event); } public void setEventSender(StreamSender sender) { eventSender = sender; } public synchronized void suspend() { suspended = true; } private synchronized boolean isSuspended() { return suspended; } }
Follow these guidelines when programming the adapter Java class; code snippets of the guidelines are shown in bold in the preceding example:
Import the interfaces and classes of the Oracle CEP API:
import com.bea.wlevs.ede.api.StreamSender; import com.bea.wlevs.ede.api.StreamSource; import com.bea.wlevs.ede.api.RunnableBean;
Because the adapter is an event source it must implement the StreamSource
interface. If you want the adapter to run in a thread, also implement RunnableBean
. The StreamSender
interface sends event types to the next component in your application network. For full details of these APIs, see Oracle CEP Java API Reference.
Import the application-specific classes that represent the event types used in the application:
import com.bea.wlevs.event.example.helloworld.HelloWorldEvent
The com.bea.wlevs.event.example.helloworld.HelloWorldEvent
class is a JavaBean that represents the event type used in the application.
The adapter class must implement the StreamSource
and RunnableBean
interfaces because it is an event source and will run in its own thread:
public class HelloWorldAdapter implements RunnableBean, StreamSource {
The StreamSource
interface provides the StreamSender
that you use to send events.
Because the adapter implements the RunnableBean
interface, your adapter must then implement the run()
method:
public void run() {...
This is where you should put the code that reads the incoming data, such as from a market feed, and convert it into an Oracle CEP event type, and then send the event to the next component in the network. Refer to the documentation of your data feed provider for details on how to read the incoming data. See Section 14.2.2.2, "Accessing Third-Party JAR Files" for information about ensuring you can access the vendor APIs if they are packaged in a third-party JAR file.
In the HelloWorld example, the adapter itself generates the incoming data using the generateHelloMessage()
private method. This is just for illustrative purposes and is not a real-world scenario. The generateHelloMessage()
method also includes the other typical event type programming tasks:
HelloWorldEvent event = new HelloWorldEvent(); event.setMessage(message); eventSender.sendInsertEvent(event);
The HelloWorldEvent
is the event type used by the HelloWorld example; the event type is implemented with a JavaBean and is registered in the EPN assembly file using the <wlevs:event-type-repository>
tag. See Section 1.5, "Creating Oracle CEP Event Types" for details. The setMessage()
method sets the properties of the event; in typical adapter implementations this is how you convert a particular property of the incoming data into an event type property. Finally, the StreamSender.sendEvent()
method sends this new event to the next component in the network.
Because your adapter implements StreamSource
, you must implement the setEventSender()
method, which passes in the StreamSender
that you use to send events:
public void setEventSender(StreamSender sender) { ...
If, as is typically the case, your adapter implements SuspendableBean
, you must implement the suspend()
method that stops the adapter when, for example, the application is undeployed:
public synchronized void suspend() throws Exception { ...
"Implementing an Adapter or Event Bean as an Event Sink" in the Oracle CEP IDE Developer's Guide for Eclipse should read as follows:
The following sample code shows a Spring bean from HelloWorld application that acts as an event sink; see the explanation after the example for the code shown in bold:
package com.bea.wlevs.example.helloworld; import com.bea.wlevs.ede.api.StreamSink; import com.bea.wlevs.event.example.helloworld.HelloWorldEvent; public class HelloWorldBean implements StreamSink { public void onInsertEvent(Object event) { if (event instanceof HelloWorldEvent) { HelloWorldEvent helloWorldEvent = (HelloWorldEvent) event; System.out.println("Message: " + helloWorldEvent.getMessage()); } } }
The programming guidelines shown in the preceding example are as follows:
Your bean must import the event type of the application, which in the HelloWorld case is HelloWorldEvent
:
import com.bea.wlevs.event.example.helloworld.HelloWorldEvent;
Your bean must implement the com.bea.wlevs.ede.api.StreamSink
interface:
public class HelloWorldBean implements StreamSink {...
The StreamSink
interface has a single method that you must implement, onInsertEvent(java.lang.Object)
, which is a callback method for receiving events. The parameter of the method is an Object
that represents the actual event that the bean received from the component that sent it the event:
public void onInsertEvent(Object event)
The data type of the events is determined by the event type you registered in the EPN assembly file of the application. In the example, the event type is HelloWorldEvent
; the code first ensures that the received event is truly a HelloWorldEvent
:
if (event instanceof HelloWorldEvent) { HelloWorldEvent helloWorldEvent = (HelloWorldEvent) event;
This event type is a JavaBean that was configured in the EPN assembly file as shown:
<wlevs:event-type-repository> <wlevs:event-type type-name="HelloWorldEvent"> <wlevs:class> com.bea.wlevs.event.example.helloworld.HelloWorldEvent </wlevs:class> </wlevs:event-type> </wlevs:event-type-repository>
See Section 1.4, "Creating the EPN Assembly File" for procedural information about creating the EPN assembly file, and Appendix D, "Schema Reference: EPN Assembly spring-wlevs-v11_0_0_0.xsd" for reference information.
Events are instances of the appropriate JavaBean, so you access the individual properties using the standard getXXX() methods
. In the example, the HelloWorldEvent
has a property called message
:
System.out.println("Message: " + helloWorldEvent.getMessage());
For complete API reference information about the Oracle CEP APIs described in this section, see the Oracle CEP Java API Reference.
"Example @Activate Annotation" in the Oracle CEP IDE Developer's Guide for Eclipse should read as follows:
package com.bea.wlevs.adapter.example.helloworld; ... import com.bea.wlevs.configuration.Activate; import com.bea.wlevs.ede.api.RunnableBean; import com.bea.wlevs.ede.api.StreamSender; import com.bea.wlevs.ede.api.StreamSource; import com.bea.wlevs.event.example.helloworld.HelloWorldEvent; public class HelloWorldAdapter implements RunnableBean, StreamSource { ... @Activate public void activateAdapter(HelloWorldAdapterConfig adapterConfig) { this.message = adapterConfig.getMessage(); } ... }
"Example @Prepare Annotation" in the Oracle CEP IDE Developer's Guide for Eclipse should read as follows:
package com.bea.wlevs.adapter.example.helloworld; ... import com.bea.wlevs.configuration.Prepare; import com.bea.wlevs.ede.api.RunnableBean; import com.bea.wlevs.ede.api.StreamSender; import com.bea.wlevs.ede.api.StreamSource; import com.bea.wlevs.event.example.helloworld.HelloWorldEvent; public class HelloWorldAdapter implements RunnableBean, StreamSource { ... @Prepare public void checkConfiguration(HelloWorldAdapterConfig adapterConfig) { if (adapterConfig.getMessage() == null || adapterConfig.getMessage().length() == 0) { throw new RuntimeException("invalid message: " + message); } } ... }
"Example @Rollback Annotation" in the Oracle CEP IDE Developer's Guide for Eclipse should read as follows:
package com.bea.wlevs.adapter.example.helloworld; ... import com.bea.wlevs.configuration.Rollback; import com.bea.wlevs.ede.api.RunnableBean; import com.bea.wlevs.ede.api.StreamSender; import com.bea.wlevs.ede.api.StreamSource; import com.bea.wlevs.event.example.helloworld.HelloWorldEvent; public class HelloWorldAdapter implements RunnableBean, StreamSource { ... @Rollback public void rejectConfigurationChange(HelloWorldAdapterConfig adapterConfig) { }