Application Development Guide

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Configuring the Stream Component

This section contains information on the following subjects:

 


Overview of the Stream Configuration File

Your Oracle Complex Event Processing (or Oracle CEP for short ) application contains one or more stream components, or streams for short. The streams stream data between other types of components, such as between adapters and processors, and between processors and the business logic POJO.

Each stream in your application has a default configuration. In particular:

The default stream configuration is typically adequate for most applications. However, if you want to change this configuration, you must create an XML file that is deployed as part of the Oracle CEP application bundle. You can later update this configuration at runtime using the wlevs.Admin utility or manipulating the appropriate JMX Mbeans directly.

If your application has more than one stream, you can create separate XML files for each stream, or create a single XML file that contains the configuration for all streams, or even all components of your application (adapters, processors, and streams). Choose the method that best suits your development environment.

 


Creating the Stream Configuration File: Main Steps

The following procedure describes the main steps to create the stream configuration file. For simplicity, it is assumed in the procedure that you are going to configure all components of an application in a single XML file

See XSD Schema Reference for Component Configuration Files for the complete XSD Schema that describes the stream configuration file.

  1. Create an XML file using your favorite XML editor.You can name this XML file anything you want, provided it ends with the .xml extension.
  2. The root element of the configuration file is <config>, with namespace definitions shown in the next step.

  3. For each stream in your application, add a <stream> child element of <config>. Uniquely identify each stream with the <name> child element. This name must be the same as the value of the id attribute in the <wlevs:stream> tag of the EPN assembly file that defines the event processing network of your application. This is how Oracle CEP knows to which particular stream component in the EPN assembly file this stream configuration applies. See Creating the EPN Assembly File for details.
  4. For example, if your application has two streams, the configuration file might initially look like:

    <?xml version="1.0" encoding="UTF-8"?>
    <helloworld:config
    xmlns:helloworld="http://www.bea.com/xml/ns/wlevs/example/helloworld">
    <processor>
    ...
    </processor>
      <stream>
    <name>firstStream</name>
    ...
    </stream>
      <stream>
    <name>secondStream</name>
    ...
    </stream>
    </helloworld:config>

    In the example, the configuration file includes two streams called firstStream and secondStream. This means that the EPN assembly file must include at least two stream registrations with the same identifiers:

    <wlevs:stream id="firstStream" ...>
    ...
    </wlevs:stream>
    <wlevs:stream id="secondStream" ...>
    ...
    </wlevs:stream>
    WARNING: Identifiers and names in XML files are case sensitive, so be sure you specify the same case when referencing the component’s identifier in the EPN assembly file.
  5. Optionally add a <max-size> child element of the <stream> element to specify the maximum size of the stream. Zero-size streams synchronously pass-through events. Streams with non-zero size process events asynchronously, buffering events by the requested size. The default value is 1024 .
  6. <stream>
    <name>firstStream</name>
    <max-size>10000</size>
    </stream>
  7. Optionally add a <max-threads> child element of the <stream> element to specify the maximum number of threads that will be used to process events for this stream. Setting this value has no effect when <max-size> is 0. The default value is 1.
  8. <stream>
    <name>firstStream</name>
    <max-threads>2</size>
    </stream>
  9. Optionally use the monitoring Boolean attribute of the <stream> element to enable or disable monitoring of the stream; by default monitoring is enabled. When monitoring is enabled, the stream gathers runtime statistics, such as the number of events inbound and outbound on it, and forwards this information to an Mbean:
  10. <stream monitoring="true">
    <name>firstStream</name>
    ...
    </stream>

    To truly enable monitoring, you must have also enabled the manageability of the stream, otherwise setting the monitoring attribute to true has no effect. You enable manageability by setting the manageable attribute of the corresponding component registration in the EPN assembly file to true, as shown in bold in the following example:

    <wlevs:stream id="firstStream" manageable="true">
    <wlevs:listener ref="helloworldProcessor"/>
    <wlevs:source ref="helloworldAdapter"/>
    </wlevs:stream>

 


Example of an Stream Configuration File

The following sample XML file shows how to configure two streamss, firstStream and secondStream.

<?xml version="1.0" encoding="UTF-8"?>
<sample:config
xmlns:sample="http://www.bea.com/xml/ns/wlevs/example/sample">
  <stream>
<name>firstStream</name>
<max-size>10</max-size>
</stream>
  <stream>
<name>secondStream</name>
<max-threads>4</max-threads>
</stream>
</sample:config>

  Back to Top       Previous  Next