21 Configuring High Availability

This chapter describes how to configure high availability for your Oracle CEP application depending on the quality of service you require, including:

For more information on high availability options, see Chapter 20, "Understanding High Availability".

21.1 Configuring High Availability Quality of Service

You configure Oracle CEP high availability quality of service in the EPN assembly file and component configuration files. For general information about these configuration files, see:

Note:

After making any Oracle CEP high availability configuration changes, you must redeploy your Oracle CEP application. See Section 24.5, "Deploying Oracle CEP Applications".

This section describes:

For more information on configuring an Oracle CEP high availability application for scalability, see Section 20.1.4, "High Availability and Scalability".

21.1.1 How to Configure Simple Failover

You configure simple failover using the Oracle CEP buffering output adapter with a sliding window size of zero (0).

This procedure starts with the example EPN that Figure 21-1 shows and adds the required components to configure it for simple failover. Example 21-1 shows the corresponding EPN assembly file and Example 21-2 shows the corresponding component configuration file.

For more information about this Oracle CEP high availability quality of service, see Section 20.2.1, "Simple Failover".

Figure 21-1 Simple Failover EPN

Description of Figure 21-1 follows
Description of "Figure 21-1 Simple Failover EPN"

Example 21-1 Simple Failover EPN Assembly File

<?xml version="1.0" encoding="UTF-8"?>
<beans ...>

    <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>

    <wlevs:adapter id="helloworldAdapter" 
        class="com.bea.wlevs.adapter.example.helloworld.HelloWorldAdapter" >
        <wlevs:instance-property name="message" value="HelloWorld - the current time is:"/>
    </wlevs:adapter>

    <wlevs:channel id="helloworldInputChannel" event-type="HelloWorldEvent" >
        <wlevs:listener ref="helloworldProcessor"/>
        <wlevs:source ref="helloworldAdapter"/>
    </wlevs:channel>

    <wlevs:processor id="helloworldProcessor" />
    
    <wlevs:channel id="helloworldOutputChannel" event-type="HelloWorldEvent" advertise="true">
        <wlevs:listener>
            <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
        </wlevs:listener>
        <wlevs:source ref="helloworldProcessor"/>
    </wlevs:channel>

</beans>

Example 21-2 Simple Failover Component Configuration Assembly File

<?xml version="1.0" encoding="UTF-8"?>
<wlevs:config 
        xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
        xmlns:ha="http://www.oracle.com/ns/cep/config/cluster/">
    <processor>
        <name>helloworldProcessor</name>
        <rules>
            <query id="helloworldRule">
                <![CDATA[ select * from helloworldInputChannel [Now] ]]>
            </query>
        </rules>
    </processor>
</wlevs:config>

To configure simple failover:

  1. Create a multi-server domain using Oracle Coherence.

    For more information, see:

  2. Create an Oracle CEP application.

    For more information, see Section 4.2, "Creating Oracle CEP Projects".

  3. Edit the MANIFEST.MF file to add the following Import-Package entries:

    • com.bea.wlevs.ede.api.cluster

    • com.oracle.cep.cluster.hagroups

    • com.oracle.cep.cluster.ha.adapter

    • com.oracle.cep.cluster.ha.api

    For more information, see Section 4.7.2, "How to Add an OSGi Bundle to an Oracle CEP Project".

  4. Configure your Oracle CEP application EPN assembly file to add an Oracle CEP high availability buffering output adapter as Example 21-3 shows.

    • Add a wlevs:adapter element with provider set to ha-buffering after channel helloworldOutputChannel.

    • Update the wlevs:listener element in channel helloworldOutputChannel to reference the ha-buffering adapter by its id.

    • Add a wlevs:listener element to the ha-buffering adapter that references the HelloWorldBean class.

    Example 21-3 Simple Failover EPN Assembly File: Buffering Output Adapter

    <?xml version="1.0" encoding="UTF-8"?>
    <beans ...>
    
        <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>
    
        <wlevs:adapter id="helloworldAdapter" 
            class="com.bea.wlevs.adapter.example.helloworld.HelloWorldAdapter" >
            <wlevs:instance-property name="message" value="HelloWorld - the current time is:"/>
        </wlevs:adapter>
    
        <wlevs:channel id="helloworldInputChannel" event-type="HelloWorldEvent" >
            <wlevs:listener ref="helloworldProcessor"/>
        </wlevs:channel>
    
        <wlevs:processor id="helloworldProcessor" />
    
        <wlevs:channel id="helloworldOutputChannel" event-type="HelloWorldEvent" advertise="true">
            <wlevs:listener ref="myHaSlidingWindowAdapter"/>
            <wlevs:source ref="helloworldProcessor"/>
        </wlevs:channel>
    
        <wlevs:adapter id="myHaSlidingWindowAdapter" provider="ha-buffering" >
            <wlevs:listener>
                <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
            </wlevs:listener>
        </wlevs:adapter>
    
    </beans>
    
  5. Optionally, configure the channel downstream from the input adapter (helloworldInputChannel) to configure an application timestamp based on an appropriate event property as Example 21-4 shows.

    For simple failover, you can use system timestamps because events are not correlated between servers. However, it is possible that slightly different results might be output from the buffer if application timestamps are not used.

    In this example, event property arrivalTime is used.

    The wlevs:expression should be set to this event property.

    Example 21-4 Application Timestamp Configuration

    ...
        <wlevs:channel id="helloworldInputChannel" event-type="HelloWorldEvent" >
            <wlevs:listener ref="helloworldProcessor"/>
            <wlevs:source ref="myHaInputAdapter"/>
            <wlevs:application-timestamped>
                <wlevs:expression>arrivalTime</wlevs:expression>
            </wlevs:application-timestamped>
        </wlevs:channel>
    ...
    
  6. Configure the Oracle CEP high availability buffering output adapter.

    Set the instance property windowLength to zero (0) as Example 21-5 shows.

    Example 21-5 Configuring windowLength in the Buffering Output Adapter

    ...
        <wlevs:adapter id="myHaSlidingWindowAdapter" provider="ha-buffering" >
            <wlevs:listener>
                <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
            </wlevs:listener>
            <wlevs:instance-property name="windowLength" value="0"/>
        </wlevs:adapter>
    ...
    

    For more information, see Section 21.2.2.1, "Buffering Output Adapter EPN Assembly File Configuration".

  7. Optionally, configure the component configuration file to include the Oracle CEP high availability buffering output adapter as Example 21-6 shows.

    Example 21-6 Simple Failover Component Configuration File With High Availability Adapters

    <?xml version="1.0" encoding="UTF-8"?>
    <wlevs:config 
            xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
            xmlns:ha="http://www.oracle.com/ns/cep/config/cluster/">
        <processor>
            <name>helloworldProcessor</name>
            <rules>
                <query id="helloworldRule">
                    <![CDATA[ select * from helloworldInputChannel [Now] ]]>
                </query>
            </rules>
        </processor>
    
        <ha:ha-buffering-adapter >
            <name>myHaSlidingWindowAdapter</name>
            <window-length>0</window-length>
        </ha:ha-buffering-adapter >
    
    </wlevs:config>
    

    For more information, see:

  8. Deploy your application to the deployment group you created in step 1.

    For more information, see Section 24.5, "Deploying Oracle CEP Applications".

    Oracle CEP automatically selects one of the Oracle CEP servers as the primary.

21.1.2 How to Configure Simple Failover With Buffering

You configure simple failover using the Oracle CEP buffering output adapter with a sliding window size greater than zero (0).

This procedure starts with the example EPN that Figure 21-2 shows and adds the required components to configure it for simple failover with buffering. Example 21-7 shows the corresponding EPN assembly file and Example 21-8 shows the corresponding component configuration file.

For more information about this Oracle CEP high availability quality of service, see Section 20.2.2, "Simple Failover with Buffering".

Figure 21-2 Simple Failover With Buffering EPN

Description of Figure 21-2 follows
Description of "Figure 21-2 Simple Failover With Buffering EPN"

Example 21-7 Simple Failover With Buffering EPN Assembly File

<?xml version="1.0" encoding="UTF-8"?>
<beans ...>

    <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>

    <wlevs:adapter id="helloworldAdapter" 
        class="com.bea.wlevs.adapter.example.helloworld.HelloWorldAdapter" >
        <wlevs:instance-property name="message" value="HelloWorld - the current time is:"/>
    </wlevs:adapter>

    <wlevs:channel id="helloworldInputChannel" event-type="HelloWorldEvent" >
        <wlevs:listener ref="helloworldProcessor"/>
        <wlevs:source ref="helloworldAdapter"/>
    </wlevs:channel>

    <wlevs:processor id="helloworldProcessor" />
    
    <wlevs:channel id="helloworldOutputChannel" 
        event-type="HelloWorldEvent" advertise="true">
        <wlevs:listener>
            <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
        </wlevs:listener>
        <wlevs:source ref="helloworldProcessor"/>
    </wlevs:channel>

</beans>

Example 21-8 Simple Failover With Buffering Component Configuration Assembly File

<?xml version="1.0" encoding="UTF-8"?>
<wlevs:config 
        xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
        xmlns:ha="http://www.oracle.com/ns/cep/config/cluster/">
    <processor>
        <name>helloworldProcessor</name>
        <rules>
            <query id="helloworldRule">
                <![CDATA[ select * from helloworldInputChannel [Now] ]]>
            </query>
        </rules>
    </processor>
</wlevs:config>

To configure simple failover with buffering:

  1. Create a multi-server domain using Oracle Coherence.

    For more information, see:

  2. Create an Oracle CEP application.

    For more information, see Section 4.2, "Creating Oracle CEP Projects".

  3. Edit the MANIFEST.MF file to add the following Import-Package entries:

    • com.bea.wlevs.ede.api.cluster

    • com.oracle.cep.cluster.hagroups

    • com.oracle.cep.cluster.ha.adapter

    • com.oracle.cep.cluster.ha.api

    For more information, see Section 4.7.2, "How to Add an OSGi Bundle to an Oracle CEP Project".

  4. Configure your Oracle CEP application EPN assembly file to add an Oracle CEP high availability buffering output adapter as Example 21-3 shows.

    • Add a wlevs:adapter element with provider set to ha-buffering after channel helloworldOutputChannel.

    • Update the wlevs:listener element in channel helloworldOutputChannel to reference the ha-buffering adapter by its id.

    • Add a wlevs:listener element to the ha-buffering adapter that references the HelloWorldBean class.

    Example 21-9 Simple Failover EPN Assembly File: Buffering Output Adapter

    <?xml version="1.0" encoding="UTF-8"?>
    <beans ...>
    
        <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>
    
        <wlevs:adapter id="helloworldAdapter" 
            class="com.bea.wlevs.adapter.example.helloworld.HelloWorldAdapter" >
            <wlevs:instance-property name="message" value="HelloWorld - the current time is:"/>
        </wlevs:adapter>
    
        <wlevs:channel id="helloworldInputChannel" event-type="HelloWorldEvent" >
            <wlevs:listener ref="helloworldProcessor"/>
        </wlevs:channel>
    
        <wlevs:processor id="helloworldProcessor" />
    
        <wlevs:channel id="helloworldOutputChannel" event-type="HelloWorldEvent" 
            advertise="true">
            <wlevs:listener ref="myHaSlidingWindowAdapter"/>
            <wlevs:source ref="helloworldProcessor"/>
        </wlevs:channel>
    
        <wlevs:adapter id="myHaSlidingWindowAdapter" provider="ha-buffering" >
            <wlevs:listener>
                <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
            </wlevs:listener>
        </wlevs:adapter>
    
    </beans>
    
  5. Optionally, configure the channel downstream from the input adapter (helloworldInputChannel) to configure an application timestamp based on an appropriate event property as Example 21-10 shows.

    For simple failover with buffering, you can use system timestamps because events are not correlated between servers. However, it is possible that slightly different results might be output from the buffer if application timestamps are not used.

    In this example, event property arrivalTime is used.

    The wlevs:expression should be set to this event property.

    Example 21-10 Application Timestamp Configuration

    ...
        <wlevs:channel id="helloworldInputChannel" event-type="HelloWorldEvent" >
            <wlevs:listener ref="helloworldProcessor"/>
            <wlevs:source ref="myHaInputAdapter"/>
            <wlevs:application-timestamped>
                <wlevs:expression>arrivalTime</wlevs:expression>
            </wlevs:application-timestamped>
        </wlevs:channel>
    ...
    
  6. Configure the Oracle CEP high availability buffering output adapter.

    Set the instance property windowLength to a value greater than zero (0) as Example 21-11 shows.

    Example 21-11 Configuring windowLength in the Buffering Output Adapter

    ...
        <wlevs:adapter id="myHaSlidingWindowAdapter" provider="ha-buffering" >
            <wlevs:listener>
                <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
            </wlevs:listener>
            <wlevs:instance-property name="windowLength" value="15000"/>
        </wlevs:adapter>
    ...
    

    For more information, see Section 21.2.2.1, "Buffering Output Adapter EPN Assembly File Configuration".

  7. Optionally, configure the component configuration file to include the Oracle CEP high availability buffering output adapter as Example 21-12 shows.

    Example 21-12 Simple Failover With Buffering Component Configuration File

    <?xml version="1.0" encoding="UTF-8"?>
    <wlevs:config 
            xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
            xmlns:ha="http://www.oracle.com/ns/cep/config/cluster/">
        <processor>
            <name>helloworldProcessor</name>
            <rules>
                <query id="helloworldRule">
                    <![CDATA[ select * from helloworldInputChannel [Now] ]]>
                </query>
            </rules>
        </processor>
    
        <ha:ha-buffering-adapter >
            <name>myHaSlidingWindowAdapter</name>
            <window-length>15000</window-length>
        </ha:ha-buffering-adapter >
    
    </wlevs:config>
    

    For more information, see:

  8. If your application is an Oracle CEP high availability Type 1 application (the application must generate exactly the same sequence of output events as existing secondaries), configure the warm-up-window-length for the buffering output adapter.

    For more information, see:

  9. Deploy your application to the deployment group you created in step 1.

    For more information, see Section 24.5, "Deploying Oracle CEP Applications".

    Oracle CEP automatically selects one of the Oracle CEP servers as the primary.

21.1.3 How to Configure Light-Weight Queue Trimming

You configure light-weight queue trimming using the Oracle CEP high availability input adapter and the broadcast output adapter.

This procedure starts with the example EPN that Figure 21-3 shows and adds the required components to configure it for light-weight queue trimming. Example 21-13 shows the corresponding EPN assembly file and Example 21-14 shows the corresponding component configuration file.

For more information about this Oracle CEP high availability quality of service, see Section 20.2.3, "Light-Weight Queue Trimming".

Figure 21-3 Light-Weight Queue Trimming EPN

Description of Figure 21-3 follows
Description of "Figure 21-3 Light-Weight Queue Trimming EPN"

Example 21-13 Light-Weight Queue Trimming EPN Assembly File

<?xml version="1.0" encoding="UTF-8"?>
<beans ...>

    <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>

    <wlevs:adapter id="helloworldAdapter" 
        class="com.bea.wlevs.adapter.example.helloworld.HelloWorldAdapter" >
        <wlevs:instance-property name="message" value="HelloWorld - the current time is:"/>
    </wlevs:adapter>

    <wlevs:channel id="helloworldInputChannel" event-type="HelloWorldEvent" >
        <wlevs:listener ref="helloworldProcessor"/>
        <wlevs:source ref="helloworldAdapter"/>
    </wlevs:channel>

    <wlevs:processor id="helloworldProcessor" />
    
    <wlevs:channel id="helloworldOutputChannel" event-type="HelloWorldEvent" 
        advertise="true">
        <wlevs:listener>
            <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
        </wlevs:listener>
        <wlevs:source ref="helloworldProcessor"/>
    </wlevs:channel>

</beans>

Example 21-14 Light-Weight Queue Trimming Component Configuration Assembly File

<?xml version="1.0" encoding="UTF-8"?>
<wlevs:config 
        xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
        xmlns:ha="http://www.oracle.com/ns/cep/config/cluster/">
    <processor>
        <name>helloworldProcessor</name>
        <rules>
            <query id="helloworldRule">
                <![CDATA[ select * from helloworldInputChannel [Now] ]]>
            </query>
        </rules>
    </processor>
</wlevs:config>

To configure light-weight queue trimming:

  1. Create a multi-server domain using Oracle Coherence.

    For more information, see:

  2. Create an Oracle CEP application.

    For more information, see Section 4.2, "Creating Oracle CEP Projects".

  3. Edit the MANIFEST.MF file to add the following Import-Package entries:

    • com.bea.wlevs.ede.api.cluster

    • com.oracle.cep.cluster.hagroups

    • com.oracle.cep.cluster.ha.adapter

    • com.oracle.cep.cluster.ha.api

    For more information, see Section 4.7.2, "How to Add an OSGi Bundle to an Oracle CEP Project".

  4. Configure your Oracle CEP application EPN assembly file to add an Oracle CEP high availability input adapter as Example 21-15 shows:

    • Add a wlevs:adapter element with provider set to ha-inbound after the regular input adapter helloworldAdapter.

    • Add a wlevs:listener element to the regular input adapter helloworldAdapter that references the ha-inbound adapter by its id.

    • Add a wlevs:source element to the helloworldInputChannel that references the ha-inbound adapter by its id.

    Example 21-15 Light-Weight Queue Trimming EPN Assembly File: High Availability Input Adapter

    <?xml version="1.0" encoding="UTF-8"?>
    <beans ...>
    
        <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>
    
        <wlevs:adapter id="helloworldAdapter" 
            class="com.bea.wlevs.adapter.example.helloworld.HelloWorldAdapter" >
            <wlevs:instance-property name="message" value="HelloWorld - the current time is:"/>
            <wlevs:listener ref="myHaInputAdapter"/>
        </wlevs:adapter>
    
        <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
        </wlevs:adapter>
    
        <wlevs:channel id="helloworldInputChannel" event-type="HelloWorldEvent" >
            <wlevs:listener ref="helloworldProcessor"/>
            <wlevs:source ref="myHaInputAdapter"/>
        </wlevs:channel>
    
        <wlevs:processor id="helloworldProcessor" />
    
        <wlevs:channel id="helloworldOutputChannel" event-type="HelloWorldEvent" 
            advertise="true">
            <wlevs:listener>
                <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
            </wlevs:listener>
            <wlevs:source ref="helloworldProcessor"/>
        </wlevs:channel>
    
    </beans>
    
  5. Configure your Oracle CEP application EPN assembly file to add an Oracle CEP high availability broadcast output adapter as Example 21-16 shows.

    • Add a wlevs:adapter element with provider set to ha-broadcast after channel helloworldOutputChannel.

    • Update the wlevs:listener element in channel helloworldOutputChannel to reference the ha-broadcast adapter by its id.

    • Add a wlevs:listener element to the ha-broadcast adapter that references the HelloWorldBean class.

    Example 21-16 Light-Weight Queue Trimming EPN Assembly File: Broadcast Output Adapter

    <?xml version="1.0" encoding="UTF-8"?>
    <beans ...>
    
        <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>
    
        <wlevs:adapter id="helloworldAdapter" 
            class="com.bea.wlevs.adapter.example.helloworld.HelloWorldAdapter" >
            <wlevs:instance-property name="message" value="HelloWorld - the current time is:"/>
            <wlevs:listener ref="myHaInputAdapter"/>
        </wlevs:adapter>
    
        <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
        </wlevs:adapter>
    
        <wlevs:channel id="helloworldInputChannel" event-type="HelloWorldEvent" >
            <wlevs:listener ref="helloworldProcessor"/>
            <wlevs:source ref="myHaInputAdapter"/>
        </wlevs:channel>
    
        <wlevs:processor id="helloworldProcessor" />
    
        <wlevs:channel id="helloworldOutputChannel" event-type="HelloWorldEvent" 
            advertise="true">
            <wlevs:listener ref="myHaBroadcastAdapter"/>
            <wlevs:source ref="helloworldProcessor"/>
        </wlevs:channel>
    
        <wlevs:adapter id="myHaBroadcastAdapter" provider="ha-broadcast" >
            <wlevs:listener>
                <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
            </wlevs:listener>
        </wlevs:adapter>
    
    </beans>
    
  6. Configure the Oracle CEP high availability input adapter.

    Consider the following example configurations:

    For more information, see Section 21.2.1.1, "High Availability Input Adapter EPN Assembly File Configuration".

    Example 21-17 High Availability Input Adapter: Default Configuration

    This example shows a high availability input adapter configuration using all defaults. The mandatory key is based on all event properties and the event property that the high availability input adapter assigns a time value to is an event property named arrivalTime.

    ...
        <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
            <wlevs:instance-property name="timeProperty" value="arrivalTime"/>
        </wlevs:adapter>
    ...
    

    Example 21-18 High Availability Input Adapter: Tuple Events

    This example shows a high availability input adapter configuration using all defaults. The mandatory key is based on all event properties and the event property that the high availability input adapter assigns a time value to is an event property named arrivalTime. Because the events are tuple-based events, you must specify the event type (MyEventType) using the eventType property.

    ...
        <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
            <wlevs:instance-property name="timeProperty" value="arrivalTime"/>
            <wlevs:instance-property name="eventType" value="MyEventType"/>
        </wlevs:adapter>
    ...
    

    Example 21-19 High Availability Input Adapter: Key of One Event Property

    This example shows a high availability input adapter configuration where the mandatory key is based on one event property (named id) and the event property that the high availability input adapter assigns a time value to is an event property named arrivalTime.

    ...
        <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
            <wlevs:instance-property name="keyProperties" value="id"/>
            <wlevs:instance-property name="timeProperty" value="arrivalTime"/>
        </wlevs:adapter>
    ...
    

    Example 21-20 High Availability Input Adapter: Key of Multiple Event Properties

    This example shows a high availability input adapter configuration where the mandatory key is based on more than one event property (properties orderID and accountID) and the event property that the high availability input adapter assigns a time value to is an event property named arrivalTime. A compound key Java class (com.acme.MyCompoundKeyClass) is mandatory and its implementation is shown in Example 21-21. The hashCode and equals methods are required. When you specify a keyClass, the keyProperties instance property is ignored: Oracle CEP assumes that the compound key is based on all the getter methods in the keyClass.

    ...
        <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
            <wlevs:instance-property name="timeProperty" value="arrivalTime"/>
            <wlevs:instance-property name="keyClass" value="com.acme.MyCompoundKeyClass"/>
        </wlevs:adapter>
    ...
    

    Example 21-21 MyCompoundKeyClass Implementation

    package com.acme;
    
    public class MyCompoundKeyClass {
        private int orderID;
        private int accountID;
    
        public MyCompoundKeyClass() {}
    
        public int getOrderID() {
            return orderID;
        }
        public setOrderID(int orderID) {
            this.orderID = orderID;
        }
        public int getAccountID() {
            return accountID;
        }
        public setOrderID(int accountID) {
            this.accountID = accountID;
        }
    
        public int hashCode() {
        int hash = 1;
        hash = hash * 31 + orderID.hashCode();
        hash = hash * 31 + (accountID == null ? 0 : accountID.hashCode());
        return hash;
        }
    
        public boolean equals(Object obj) {
            if (obj == this) return true;
            if (obj == null) return false;
            if (!(obj instanceof MyCompoundKeyClass)) return false;
            MyCompoundKeyClass k = (MyCompoundKeyClass) obj;
            return k.accountID == accountID && k.orderID == orderID;
        }
    }
    
  7. Configure the channel downstream from the high availability input adapter (helloworldInputChannel) to configure an application timestamp based on the high availability input adapter timeProperty setting as Example 21-22 shows.

    The wlevs:expression should be set to the timeProperty value.

    Example 21-22 Application Timestamp Configuration

    ...
        <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
            <wlevs:instance-property name="keyProperties" value="id"/>
            <wlevs:instance-property name="eventType" value="HelloWorldEvent"/>
            <wlevs:instance-property name="timeProperty" value="arrivalTime"/>
        </wlevs:adapter>
    
        <wlevs:channel id="helloworldInputChannel" event-type="HelloWorldEvent" >
            <wlevs:listener ref="helloworldProcessor"/>
            <wlevs:source ref="myHaInputAdapter"/>
            <wlevs:application-timestamped>
                <wlevs:expression>arrivalTime</wlevs:expression>
            </wlevs:application-timestamped>
        </wlevs:channel>
    ...
    
  8. Configure the Oracle CEP high availability broadcast output adapter.

    Consider the following example configurations:

    For more information, see Section 21.2.3.1, "Broadcast Output Adapter EPN Assembly File Configuration".

    Example 21-23 Broadcast Output Adapter: Default Configuration

    This example shows a broadcast output adapter configuration using all defaults. The mandatory key is based on all event properties, key values are nonmonotonic (do not increase continually) and total order (unique).

    ...
        <wlevs:adapter id="myHaSlidingWindowAdapter" provider="ha-buffering" >
            <wlevs:listener>
                <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
            </wlevs:listener>
        </wlevs:adapter>
    ...
    

    Example 21-24 Broadcast Output Adapter: Key of One Event Property

    This example shows a broadcast output adapter configuration where the mandatory key is based on one event property (named timeProperty), key values are monotonic (they do increase continually) and not total order (not unique).

    ...
        <wlevs:adapter id="myHaSlidingWindowAdapter" provider="ha-buffering" >
            <wlevs:listener>
                <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
            </wlevs:listener>
            <wlevs:instance-property name="keyProperties" value="timeProperty"/>
            <wlevs:instance-property name="monotonic" value="true"/>
            <wlevs:instance-property name="total-order" value="false"/>
        </wlevs:adapter>
    ...
    

    Example 21-25 Broadcast Output Adapter: Key of Multiple Event Properties

    This example shows a broadcast output adapter configuration where the mandatory key is based on more than one event property (properties timeProperty and accountID), key values are monotonic (they do increase continually) and total order (unique). A compound key Java class (com.acme.MyCompoundKeyClass) is mandatory and its implementation is shown in Example 21-26. The hashCode and equals methods are required. When you specify a keyClass, the keyProperties instance property is ignored: Oracle CEP assumes that the compound key is based on all the getter methods in the keyClass.

    ...
        <wlevs:adapter id="myHaSlidingWindowAdapter" provider="ha-buffering" >
            <wlevs:listener>
                <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
            </wlevs:listener>
            <wlevs:instance-property name="keyClass" value="com.acme.MyCompoundKeyClass"/>
            <wlevs:instance-property name="monotonic" value="true"/>
            <wlevs:instance-property name="total-order" value="true"/>
        </wlevs:adapter>
    ...
    

    Example 21-26 MyCompoundKeyClass Implementation

    package com.acme;
    
    public class MyCompoundKeyClass {
        private int timeProperty;
        private int accountID;
    
        public MyCompoundKeyClass() {}
    
        public int getTimeProperty() {
            return orderID;
        }
        public setTimeProperty(int timeProperty) {
            this.timeProperty = timeProperty;
        }
        public int getAccountID() {
            return accountID;
        }
        public setOrderID(int accountID) {
            this.accountID = accountID;
        }
    
        public int hashCode() {
        int hash = 1;
        hash = hash * 31 + timeProperty.hashCode();
        hash = hash * 31 + (accountID == null ? 0 : accountID.hashCode());
        return hash;
        }
    
        public boolean equals(Object obj) {
            if (obj == this) return true;
            if (obj == null) return false;
            if (!(obj instanceof MyCompoundKeyClass)) return false;
            MyCompoundKeyClass k = (MyCompoundKeyClass) obj;
            return k.accountID == accountID && k.orderID == orderID;
        }
    }
    
  9. Optionally, configure the component configuration file to include the Oracle CEP high availability input adapter and buffering output adapter as Example 21-27 shows.

    Example 21-27 Light-Weight Queue Trimming Component Configuration File

    <?xml version="1.0" encoding="UTF-8"?>
    <wlevs:config 
            xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
            xmlns:ha="http://www.oracle.com/ns/cep/config/cluster/">
        <processor>
            <name>helloworldProcessor</name>
            <rules>
                <query id="helloworldRule">
                    <![CDATA[ select * from helloworldInputChannel [Now] ]]>
                </query>
            </rules>
        </processor>
    
        <ha:ha-inbound-adapter>
            <name>myHaInputAdapter</name>
        </ha:ha-inbound-adapter>
     
        <ha:ha-broadcast-adapter>
            <name>myHaBroadcastAdapter</name>
            <trimming-interval units="events">10</trimming-interval>
        </ha:ha-broadcast-adapter>
    
    </wlevs:config>
    

    For more information, see:

  10. If your application is an Oracle CEP high availability Type 1 application (the application must generate exactly the same sequence of output events as existing secondaries), configure the warm-up-window-length for the broadcast output adapter.

    For more information, see:

  11. Deploy your application to the deployment group you created in step 1.

    For more information, see Section 24.5, "Deploying Oracle CEP Applications".

    Oracle CEP automatically selects one of the Oracle CEP servers as the primary.

21.1.4 How to Configure Precise Recovery With JMS

You configure precise recovery with JMS using the Oracle CEP high availability input adapter and correlating output adapter.

This procedure describes how to create the example EPN that Figure 21-4 shows. Example 21-28 shows the corresponding EPN assembly file and Example 21-29 shows the corresponding component configuration file.

For more information about this Oracle CEP high availability quality of service, see Section 20.2.4, "Precise Recovery with JMS".

Figure 21-4 Precise Recovery With JMS EPN

Description of Figure 21-4 follows
Description of "Figure 21-4 Precise Recovery With JMS EPN"

Example 21-28 Precise Recovery With JMS EPN Assembly File

<?xml version="1.0" encoding="UTF-8"?>
<beans ... >

    <wlevs:event-type-repository>
        <wlevs:event-type type-name="StockTick">
            <wlevs:properties>
                <wlevs:property name="lastPrice" type="double" />
                <wlevs:property name="symbol" type="char" />
            </wlevs:properties>
        </wlevs:event-type>
    </wlevs:event-type-repository>

    <wlevs:adapter id="JMSInboundAdapter" provider="jms-inbound">
        <wlevs:listener ref="myHaInputAdapter"/>
    </wlevs:adapter>

    <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
        <wlevs:instance-property name="keyProperties" value="sequenceNo"/>
        <wlevs:instance-property name="timeProperty" value="inboundTime"/>
    </wlevs:adapter>

    <wlevs:channel id="channel1" event-type="StockTick">
        <wlevs:listener ref="processor1" />
        <wlevs:source ref="myHaInputAdapter"/>
        <wlevs:application-timestamped>
            <wlevs:expression>inboundTime</wlevs:expression>
        </wlevs:application-timestamped>
    </wlevs:channel>

    <wlevs:processor id="processor1">
        <wlevs:listener ref="channel2" />
    </wlevs:processor>

    <wlevs:adapter id="myHaCorrelatingAdapter" provider="ha-correlating" >
        <wlevs:instance-property name="correlatedSource" ref="clusterCorrelatingOutstream"/> 
        <wlevs:instance-property name="failOverDelay" value="2000"/> 
        <wlevs:listener ref="JMSOutboundAdapter"/>
    </wlevs:adapter>

    <wlevs:channel id="channel2" event-type="StockTick">
        <wlevs:listener ref="myHaCorrelatingAdapter" />
    </wlevs:channel>

    <wlevs:adapter id="JMSOutboundAdapter" provider="jms-outbound">
    </wlevs:adapter>

    <wlevs:adapter id="JMSInboundAdapter2" provider="jms-inbound">
    </wlevs:adapter>

    <wlevs:channel id="clusterCorrelatingOutstream" event-type="StockTick" advertise="true">
        <wlevs:source ref="JMSInboundAdapter2"/>
    </wlevs:channel> 
</beans>

Example 21-29 Precise Recovery With JMS Component Configuration Assembly File

<?xml version="1.0" encoding="UTF-8"?>
<wlevs:config 
        xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
        xmlns:ha="http://www.oracle.com/ns/cep/config/cluster/">
    <processor>
        <name>processor1</name>
        <rules>
            <query id="helloworldRule">
                <![CDATA[ select * from channel1 [Now] ]]>
            </query>
        </rules>
    </processor>
</wlevs:config>

To configure precise recovery with JMS:

  1. Create a multi-server domain using Oracle Coherence.

    For more information, see:

  2. Create an Oracle CEP application.

    For more information, see Section 4.2, "Creating Oracle CEP Projects".

  3. Edit the MANIFEST.MF file to add the following Import-Package entries:

    • com.bea.wlevs.ede.api.cluster

    • com.oracle.cep.cluster.hagroups

    • com.oracle.cep.cluster.ha.adapter

    • com.oracle.cep.cluster.ha.api

    For more information, see Section 4.7.2, "How to Add an OSGi Bundle to an Oracle CEP Project".

  4. Configure your Oracle CEP application EPN assembly file to add an Oracle CEP high availability input adapter as Example 21-30 shows:

    • Add a wlevs:adapter element with provider set to ha-inbound after the regular input adapter JMSInboundAdapter.

    • Add a wlevs:listener element to the regular input adapter JMSInboundAdapter that references the ha-inbound adapter by its id.

    • Add a wlevs:source element to the channel channel1 that references the ha-inbound adapter by its id.

    Example 21-30 Precise Recovery With JMS EPN Assembly File: High Availability Input Adapter

    <?xml version="1.0" encoding="UTF-8"?>
    <beans ...>
    
        <wlevs:event-type-repository>
            <wlevs:event-type type-name="StockTick">
                <wlevs:properties>
                    <wlevs:property name="lastPrice" type="double" />
                    <wlevs:property name="symbol" type="char" />
                </wlevs:properties>
            </wlevs:event-type>
        </wlevs:event-type-repository>
    
        <wlevs:adapter id="JMSInboundAdapter" provider="jms-inbound">
            <wlevs:listener ref="myHaInputAdapter"/>
        </wlevs:adapter>
    
        <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
        </wlevs:adapter>
    
        <wlevs:channel id="channel1" event-type="StockTick">
            <wlevs:listener ref="processor1" />
            <wlevs:source ref="myHaInputAdapter"/>
        </wlevs:channel>
    
    ...
    
    </beans>
    
  5. Configure your Oracle CEP application EPN assembly file to add an Oracle CEP high availability correlating output adapter as Example 21-31 shows.

    • Add a wlevs:adapter element with provider set to ha-correlating after channel channel2.

    • Update the wlevs:listener element in channel channel2 to reference the ha-correlating adapter by its id.

    • Add a wlevs:listener element to the ha-correlating adapter that references the regular output adapter JMSOutboundAdapter.

    Example 21-31 Precise Recovery With JMS EPN Assembly File: Correlating Output Adapter

    <?xml version="1.0" encoding="UTF-8"?>
    <beans ...>
    
        <wlevs:event-type-repository>
            <wlevs:event-type type-name="StockTick">
                <wlevs:properties>
                    <wlevs:property name="lastPrice" type="double" />
                    <wlevs:property name="symbol" type="char" />
                </wlevs:properties>
            </wlevs:event-type>
        </wlevs:event-type-repository>
    
        <wlevs:adapter id="JMSInboundAdapter" provider="jms-inbound">
            <wlevs:listener ref="myHaInputAdapter"/>
        </wlevs:adapter>
    
        <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
        </wlevs:adapter>
    
        <wlevs:channel id="channel1" event-type="StockTick">
            <wlevs:listener ref="processor1" />
            <wlevs:source ref="myHaInputAdapter"/>
        </wlevs:channel>
    
        <wlevs:processor id="processor1">
            <wlevs:listener ref="channel2" />
        </wlevs:processor>
    
        <wlevs:channel id="channel2" event-type="StockTick">
            <wlevs:listener ref="myHaCorrelatingAdapter" />
        </wlevs:channel>
    
        <wlevs:adapter id="myHaCorrelatingAdapter" provider="ha-correlating" >
            <wlevs:listener ref="JMSOutboundAdapter"/>
        </wlevs:adapter>
    
        <wlevs:adapter id="JMSOutboundAdapter" provider="jms-outbound">
        </wlevs:adapter>
    
    ...
    
    </beans>
    
  6. Configure the Oracle CEP high availability input adapter.

    Consider the following example configurations:

    For more information, see Section 21.2.1.1, "High Availability Input Adapter EPN Assembly File Configuration".

    Example 21-32 High Availability Input Adapter: Default Configuration

    This example shows a high availability input adapter configuration using all defaults. The mandatory key is based on all event properties and the event property that the high availability input adapter assigns a time value to is an event property named arrivalTime.

    ...
        <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
            <wlevs:instance-property name="timeProperty" value="arrivalTime"/>
        </wlevs:adapter>
    ...
    

    Example 21-33 High Availability Input Adapter: Tuple Events

    This example shows a high availability input adapter configuration using all defaults. The mandatory key is based on all event properties and the event property that the high availability input adapter assigns a time value to is an event property named arrivalTime. Because the events are tuple-based events, you must specify the event type (MyEventType) using the eventType property.

    ...
        <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
            <wlevs:instance-property name="timeProperty" value="arrivalTime"/>
            <wlevs:instance-property name="eventType" value="MyEventType"/>
        </wlevs:adapter>
    ...
    

    Example 21-34 High Availability Input Adapter: Key of One Event Property

    This example shows a high availability input adapter configuration where the mandatory key is based on one event property (named sequenceNo) and the event property that the high availability input adapter assigns a time value to is an event property named inboundTime.

    ...
        <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
            <wlevs:instance-property name="keyProperties" value="sequenceNo"/>
            <wlevs:instance-property name="timeProperty" value="inboundTime"/>
        </wlevs:adapter>
    ...
    

    Example 21-35 High Availability Input Adapter: Key of Multiple Event Properties

    This example shows a high availability input adapter configuration where the mandatory key is based on more than one event property (properties orderID and accountID) and the event property that the high availability input adapter assigns a time value to is an event property named arrivalTime. A compound key Java class (com.acme.MyCompoundKeyClass) is mandatory and its implementation is shown in Example 21-36. The hashCode and equals methods are required. When you specify a keyClass, the keyProperties instance property is ignored: Oracle CEP assumes that the compound key is based on all the getter methods in the keyClass.

    ...
        <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
            <wlevs:instance-property name="timeProperty" value="arrivalTime"/>
            <wlevs:instance-property name="keyClass" value="com.acme.MyCompoundKeyClass"/>
        </wlevs:adapter>
    ...
    

    Example 21-36 MyCompoundKeyClass Implementation

    package com.acme;
    
    public class MyCompoundKeyClass {
        private int orderID;
        private int accountID;
    
        public MyCompoundKeyClass() {}
    
        public int getOrderID() {
            return orderID;
        }
        public setOrderID(int orderID) {
            this.orderID = orderID;
        }
        public int getAccountID() {
            return accountID;
        }
        public setOrderID(int accountID) {
            this.accountID = accountID;
        }
    
        public int hashCode() {
        int hash = 1;
        hash = hash * 31 + orderID.hashCode();
        hash = hash * 31 + (accountID == null ? 0 : accountID.hashCode());
        return hash;
        }
    
        public boolean equals(Object obj) {
            if (obj == this) return true;
            if (obj == null) return false;
            if (!(obj instanceof MyCompoundKeyClass)) return false;
            MyCompoundKeyClass k = (MyCompoundKeyClass) obj;
            return k.accountID == accountID && k.orderID == orderID;
        }
    }
    
  7. Configure the channel downstream from the high availability input adapter (channel1) to configure an application timestamp based on the high availability input adapter timeProperty setting as Example 21-37 shows.

    The wlevs:expression should be set to the timeProperty value.

    Example 21-37 Application Timestamp Configuration

    ...
        <wlevs:adapter id="myHaInputAdapter" provider="ha-inbound" >
            <wlevs:instance-property name="eventType" value="HelloWorldEvent"/>
            <wlevs:instance-property name="keyProperties" value="sequenceNo"/>
            <wlevs:instance-property name="timeProperty" value="inboundTime"/>
        </wlevs:adapter>
    
        <wlevs:channel id="channel1" event-type="StockTick">
            <wlevs:listener ref="processor1" />
            <wlevs:source ref="myHaInputAdapter"/>
            <wlevs:application-timestamped>
                <wlevs:expression>inboundTime</wlevs:expression>
            </wlevs:application-timestamped>
        </wlevs:channel>
    ...
    
  8. Configure the Oracle CEP high availability correlating output adapter failOverDelay.

    Example 21-38 shows a correlating output adapter configuration where the failOverDelay is 2000 milliseconds.

    Example 21-38 Correlating Output Adapter Configuration: failOverDelay

    ...
        <wlevs:adapter id="myHaCorrelatingAdapter" provider="ha-correlating" >
            <wlevs:listener ref="JMSOutboundAdapter"/>
            <wlevs:instance-property name="failOverDelay" value="2000"/>
        </wlevs:adapter>
    ...
    

    For more information, see Section 21.2.4.1, "Correlating Output Adapter EPN Assembly File Configuration".

  9. Create a second regular JMS input adapter.

    Example 21-39 shows a JMS adapter named JMSInboundAdapter2.

    Example 21-39 Inbound JMS Adapter Assembly File

    ...
        <wlevs:adapter id="JMSInboundAdapter2" provider="jms-inbound">
        </wlevs:adapter>
    ...
    

    This JMS input adapter must be configured identically to the first JMS input adapter (in this example, JMSInboundAdapter). Example 21-40 shows the component configuration file for both the JMS input adapters. Note that both have exactly the same configuration, including the same provider.

    Example 21-40 Inbound JMS Adapter Component Configuration File

    <?xml version="1.0" encoding="UTF-8"?>
    <wlevs:config 
            xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
            xmlns:ha="http://www.oracle.com/ns/cep/config/cluster/">
        ...
        <jms-adapter>
            <name>JMSInboundAdapter</name>
            <jndi-provider-url>t3://localhost:7001</jndi-provider-url>
            <destination-jndi-name>./Queue1</destination-jndi-name>
            <user>weblogic</user>
            <password>weblogic</password>
            <work-manager>JettyWorkManager</work-manager>
            <concurrent-consumers>1</concurrent-consumers>
        </jms-adapter>
    
        <jms-adapter>
            <name>JMSInboundAdapter2</name>
            <jndi-provider-url>t3://localhost:7001</jndi-provider-url>
            <destination-jndi-name>./Queue1</destination-jndi-name>
            <user>weblogic</user>
            <password>weblogic</password>
            <work-manager>JettyWorkManager</work-manager>
            <concurrent-consumers>1</concurrent-consumers>
        </jms-adapter>
        ...
    </wlevs:config>
    
  10. Create a channel to function as the correlated source.

    You must configure this channel with the second regular JMS input adapter as its source.

    Example 21-41 shows a correlated source named clusterCorrelatingOutstream whose source is JMSInboundAdapter2.

    Example 21-41 Creating the Correlated Source

    ...
        <wlevs:adapter id="JMSInboundAdapter2" provider="jms-inbound">
        </wlevs:adapter>
    
        <wlevs:channel id="clusterCorrelatingOutstream" event-type="StockTick" advertise="true">
            <wlevs:source ref="JMSInboundAdapter2"/>
        </wlevs:channel> 
    
  11. Configure the Oracle CEP high availability correlating output adapter with the correlatedSource.

    Example 21-38 shows a correlating output adapter configuration where the correlatedSource is clusterCorrelatingOutstream.

    Example 21-42 Correlating Output Adapter: correlatedSource

    ...
        <wlevs:adapter id="myHaCorrelatingAdapter" provider="ha-correlating" >
            <wlevs:listener ref="JMSOutboundAdapter"/>
            <wlevs:instance-property name="failOverDelay" value="2000"/>
            <wlevs:instance-property name="correlatedSource" value="clusterCorrelatingOutstream"/>
        </wlevs:adapter>
    ...
    

    For more information, see Section 21.2.4.1, "Correlating Output Adapter EPN Assembly File Configuration".

  12. If your application is an Oracle CEP high availability Type 1 application (the application must generate exactly the same sequence of output events as existing secondaries), configure the warm-up-window-length for the correlating output adapter.

    For more information, see:

  13. Configure the component configuration file to enable session-transacted for both inbound JMS adapters and the outbound JMS adapter as Example 21-43 shows:

    Example 21-43 Inbound and Outbound JMS Adapter Component Configuration File

    <?xml version="1.0" encoding="UTF-8"?>
    <wlevs:config 
            xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
            xmlns:ha="http://www.oracle.com/ns/cep/config/cluster/">
        ...
        <jms-adapter>
            <name>JMSInboundAdapter</name>
            <jndi-provider-url>t3://localhost:7001</jndi-provider-url>
            <destination-jndi-name>./Queue1</destination-jndi-name>
            <user>weblogic</user>
            <password>weblogic</password>
            <work-manager>JettyWorkManager</work-manager>
            <concurrent-consumers>1</concurrent-consumers>
            <session-transacted>true</session-transacted>
        </jms-adapter>
    
        <jms-adapter>
            <name>JMSInboundAdapter2</name>
            <jndi-provider-url>t3://localhost:7001</jndi-provider-url>
            <destination-jndi-name>./Queue1</destination-jndi-name>
            <user>weblogic</user>
            <password>weblogic</password>
            <work-manager>JettyWorkManager</work-manager>
            <concurrent-consumers>1</concurrent-consumers>
            <session-transacted>true</session-transacted>
        </jms-adapter>
        ...
        <jms-adapter>
            <name>JMSOutboundAdapter</name>
            <event-type>JMSEvent</event-type>
            <jndi-provider-url>t3://localhost:7001</jndi-provider-url>
            <destination-jndi-name>Topic1</destination-jndi-name>
            <delivery-mode>nonpersistent</delivery-mode>
            <session-transacted>true</session-transacted>
        </jms-adapter>
        ...
    </wlevs:config>
    
  14. Optionally, configure the component configuration file to include the Oracle CEP high availability input adapter and correlating output adapter as Example 21-27 shows.

    Example 21-44 High Availability Input and Output Adapter Component Configuration File

    <?xml version="1.0" encoding="UTF-8"?>
    <wlevs:config 
            xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
            xmlns:ha="http://www.oracle.com/ns/cep/config/cluster/">
        ...
        <ha:ha-inbound-adapter>
            <name>myHaInputAdapter</name>
        </ha:ha-inbound-adapter>
        ...
        <ha:ha-correlating-adapter>
            <name>myHaBroadcastAdapter</name>
            <fail-over-delay>2000</fail-over-delay>
        </ha:ha-correlating-adapter>
        ...
    </wlevs:config>
    

    For more information, see:

  15. Optionally, add an ActiveActiveGroupBean to your EPN to improve scalability.

    For more information, see Section 23.2, "Configuring Scalability With the ActiveActiveGroupBean".

  16. Deploy your application to the deployment group you created in step 1.

    For more information, see Section 24.5, "Deploying Oracle CEP Applications".

    Oracle CEP automatically selects one of the Oracle CEP servers as the primary.

21.2 Configuring High Availability Adapters

You configure Oracle CEP high availability adapters in the EPN assembly file and component configuration files, similar to how you configure other components in the EPN, such as channels or processors. For general information about these configuration files, see:

Note:

After making any Oracle CEP high availability configuration changes, you must redeploy your Oracle CEP application. See Section 24.5, "Deploying Oracle CEP Applications".

This section describes the configurable options for each of the Oracle CEP high availability adapters, including:

21.2.1 How to Configure the High Availability Input Adapter

The Oracle CEP high availability broadcast output adapter is implemented by BroadcastInputAdapter.

This section describes how to configure the Oracle CEP high availability input adapter, including:

For more information, see Section 20.1.3.1, "High Availability Input Adapter".

21.2.1.1 High Availability Input Adapter EPN Assembly File Configuration

The root element for declaring an Oracle CEP high availability input adapter is wlevs:adapter with provider element set to ha-inbound as Example 21-45 shows. You specify a wlevs:listener element for the Oracle CEP high availability input adapter in the actual input adapter as Example 21-45 shows.

Example 21-45 High Availability Input Adapter EPN Assembly File

<wlevs:adapter id="jmsAdapter" provider="jms-inbound"
    <wlevs:listener ref="myHaInputAdapter"/>      
</wlevs:adapter>

<wlevs:adapter id="myHaInputAdapter" provider="ha-inbound">
    <wlevs:instance-property name="keyProperties" value="id"/>
    <wlevs:instance-property name="timeProperty" value="arrivalTime"/>
    <wlevs:instance-property name="eventType" value="MyEventType"/>
</wlevs:adapter>

<wlevs:channel id="inputChannel" event-type="MyEventType ">
    <wlevs:source ref="myHaInputAdapter"/>
    <wlevs:application-timestamped>
        <wlevs:expression>arrivalTime</wlevs:expression>
    </wlevs:application-timestamped>
</wlevs:channel>

Table 21-1 describes the additional child elements of wlevs:adapter you can configure for an Oracle CEP high availability input adapter.

Table 21-1 Child Elements of wlevs:adapter for the High Availability Input Adapter

Child Element Description

wlevs:instance-property

Specify one or more instance-property element name and value attributes as Table 21-2 describes.


Table 21-2 lists the instance properties that the Oracle CEP high availability input adapter supports.

Table 21-2 High Availability Input Adapter Instance Properties

Name Value

timeProperty

Specify the name of the event property to which the high availability input adapter assigns a time value.

This is the same property that you use in the wlevs:application-timestamped element of the downstream EPN component to which the high availability input adapter is connected as Example 21-45 shows.

keyProperties

Specify a space delimited list of one or more event properties that the Oracle CEP high availability input adapter uses to identify event instances.

If you specify more than one event property, you must specify a keyClass.

Default: all event properties.

keyClass

Specify the fully qualified class name of a Java class used as a compound key.

By default, all JavaBean properties in the keyClass are assumed to be keyProperties, unless the keyProperties setting is used.

eventType

Specify the type name of the events that the Oracle CEP high availability input adapter receives from the actual input adapter. This is the same event type that you use in the downstream EPN component to which the high availability input adapter is connected as Example 21-45 shows.

For tuple events, this property is mandatory.

For all other Java class-based event types, this property is optional.

For more information, see Section 1.1.2, "Oracle CEP Event Types".


21.2.1.2 High Availability Input Adapter Component Configuration File Configuration

The root element for configuring an Oracle CEP high availability input adapter is ha-inbound-adapter. The name child element for a particular adapter must match the id attribute of the corresponding wlevs:adapter element in the EPN assembly file that declares this adapter as Example 21-50 shows.

Example 21-46 High Availability Input Adapter Component Configuration File

<ha:ha-inbound-adapter>
    <name>myHaInputAdapter</name>
    <heartbeat units="millis">1000</heartbeat>
    <batch-size>10</batch-size>
</ha:ha-inbound-adapter>

Table 21-3 describes the additional child elements of ha-inbound-adapter you can configure for an Oracle CEP high availability input adapter.

Table 21-3 Child Elements of ha-inbound-adapter for the High Availability Input Adapter

Child Element Description

heartbeat

Specify the length of time that the Oracle CEP high availability input adapter can be idle before it generates a heartbeat event to advance time as an integer number of units.

Valid values for attribute units:

  • nanos: wait the specified number of nanoseconds.

  • millis: wait the specified number of milliseconds.

  • secs: wait the specified number of seconds.

Default: Heartbeats are not sent.

batch-size

Specify the number of events in each timing message that the primary broadcasts to its secondaries. A value of n means that n {key, time} pairs are sent in each message. You can use this property for performance tuning (see Section 27.2.3, "High Availability Input Adapter Configuration"

Default: 1 (disable batching).


21.2.2 How to Configure the Buffering Output Adapter

The Oracle CEP high availability buffering output adapter is implemented by SlidingWindowQueueTrimmingAdapter.

This section describes how to configure the Oracle CEP high availability buffering output adapter, including:

For more information, see Section 20.1.3.2, "Buffering Output Adapter".

21.2.2.1 Buffering Output Adapter EPN Assembly File Configuration

The root element for declaring an Oracle CEP high availability buffering output adapter is wlevs:adapter with provider element set to ha-buffering as Example 21-47 shows.

Example 21-47 Buffering Output Adapter EPN Assembly File

<wlevs:adapter id="mySlidingWindowingAdapter" provider ="ha-buffering">
    <wlevs:listener>
        <bean class="com.bea.wlevs.example.cluster.ClusterAdapterBean"/>
    </wlevs:listener>
    <wlevs:instance-property name="windowLength" value="15000"/>
</wlevs:adapter>

Table 21-4 describes the additional child elements of wlevs:adapter you can configure for an Oracle CEP high availability buffering output adapter.

Table 21-4 Child Elements of wlevs:adapter for the Buffering Output Adapter

Child Element Description

wlevs:listener

Specify the regular output adapter downstream from this Oracle CEP high availability buffering output adapter.

wlevs:instance-property

Specify one or more instance-property element name and value attributes as Table 21-5 describes.


Table 21-5 lists the instance properties that the Oracle CEP high availability broadcast output adapter supports.

Table 21-5 Buffering Output Adapter Instance Properties

Name Value

windowLength

Specify the size of the sliding window as an integer number of milliseconds.

Default: 15000.


21.2.2.2 Buffering Output Adapter Component Configuration File Configuration

The root element for configuring an Oracle CEP high availability buffering output adapter is ha-buffering-adapter. The name child element for a particular adapter must match the id attribute of the corresponding wlevs:adapter element in the EPN assembly file that declares this adapter as Example 21-48 shows.

Example 21-48 Buffering Output Adapter Component Configuration File

<ha:ha-buffering-adapter >
    <name>mySlidingWindowingAdapter</name>
    <window-length>15000</window-length>
    <warm-up-window-length units="minutes">6</warm-up-window-length>
</ha:ha-buffering-adapter >

Table 21-6 describes the additional child elements of ha-buffering-adapter you can configure for an Oracle CEP high availability buffering output adapter.

Table 21-6 Child Elements of ha-buffering-adapter for the Buffering Output Adapter

Child Element Description

window-length

Specify the size of the sliding window as an integer number of milliseconds.

Default: 15000.

warm-up-window

Specify the length of time it takes the application to rebuild state after a previously failed secondary restarts or a new secondary is added as an integer number of units.

Valid values for attribute units:

  • seconds: wait the specified number of seconds.

  • minutes: wait the specified number of minutes.

Default: units is events.

For more information, see Section 20.3.2.5, "Choose an Adequate warm-up-window Time".


21.2.3 How to Configure the Broadcast Output Adapter

The Oracle CEP high availability broadcast output adapter is implemented by class GroupBroadcastQueueTrimmingAdapter.

This section describes how to configure the Oracle CEP high availability broadcast output adapter, including:

For more information, see Section 20.1.3.3, "Broadcast Output Adapter".

21.2.3.1 Broadcast Output Adapter EPN Assembly File Configuration

The root element for declaring an Oracle CEP high availability broadcast output adapter is wlevs:adapter with provider element set to ha-broadcast as Example 21-49 shows.

Example 21-49 Broadcast Output Adapter EPN Assembly File

<wlevs:adapter id="myBroadcastAdapter" provider="ha-broadcast">
    <wlevs:listener ref="actualAdapter"/>
    <wlevs:instance-property name="keyProperties" value="time"/>
    <wlevs:instance-property name="monotonic" value="true"/>
</wlevs:adapter>

Table 21-7 describes the additional child elements of wlevs:adapter you can configure for an Oracle CEP high availability broadcast output adapter.

Table 21-7 Child Elements of wlevs:adapter for the Broadcast Output Adapter

Child Element Description

wlevs:listener

Specify the regular output adapter downstream from this Oracle CEP high availability broadcast output adapter.

wlevs:instance-property

Specify one or more instance-property element name and value attributes as Table 21-8 describes.


Table 21-8 lists the instance properties that the Oracle CEP high availability broadcast output adapter supports.

Table 21-8 Broadcast Output Adapter Instance Properties

Name Value

keyProperties

Specify a space delimited list of one or more event properties that the Oracle CEP high availability broadcast output adapter uses to identify event instances.

If you specify more than one event property, you must specify a keyClass.

Default: all event properties.

keyClass

Specify the fully qualified class name of a Java class used as a compound key.

By default, all JavaBean properties in the keyClass are assumed to be keyProperties, unless the keyProperties setting is used.

A compound key may be monotonic and may be total-order.

monotonic

Specify whether or not the key value is constantly increasing (like a time value).

Valid values are:

  • true: the key is constantly increasing.

  • false: the key is not constantly increasing.

Default: false.

total-order

Specify whether or not event keys are unique. Applicable only when instance property monotonic is set to true.

Valid values are:

  • true: event keys are unique.

  • false: event keys are not unique.

Default: true.


21.2.3.2 Broadcast Output Adapter Component Configuration File Configuration

The root element for configuring an Oracle CEP high availability broadcast output adapter is ha-broadcast-adapter. The name child element for a particular adapter must match the id attribute of the corresponding wlevs:adapter element in the EPN assembly file that declares this adapter as Example 21-50 shows.

Example 21-50 Broadcast Output Adapter Component Configuration File

<ha:ha-broadcast-adapter>
    <name>myBroadcastAdapter</name>
    <trimming-interval units="events">10</trimming-interval>
    <warm-up-window-length units="minutes">6</warm-up-window-length>
</ha:ha-broadcast-adapter>

Table 21-9 describes the additional child elements of ha-broadcast-adapter you can configure for an Oracle CEP high availability broadcast output adapter.

Table 21-9 Child Elements of ha-broadcast-adapter for the Broadcast Output Adapter

Child Element Description

trimming-interval

Specify the interval at which trimming messages are broadcast as an integer number of units. You can use this property for performance tuning (see Section 27.2.4, "Broadcast Output Adapter Configuration").

Valid values for attribute units:

  • events: broadcast trimming messages after the specified number of milliseconds.

  • millis: broadcast trimming messages after the specified number of events are processed.

Default: units is events.

warm-up-window

Specify the length of time it takes the application to rebuild state after a previously failed secondary restarts or a new secondary is added as an integer number of units.

Valid values for attribute units:

  • seconds: wait the specified number of seconds.

  • minutes: wait the specified number of minutes.

Default: units is events.

For more information, see Section 20.3.2.5, "Choose an Adequate warm-up-window Time".


21.2.4 How to Configure the Correlating Output Adapter

The Oracle CEP high availability correlating output adapter is implemented by class CorrelatedQueueTrimmingAdapter.

This section describes how to configure the Oracle CEP high availability correlating output output adapter, including:

For more information, see Section 20.1.3.4, "Correlating Output Adapter".

21.2.4.1 Correlating Output Adapter EPN Assembly File Configuration

The root element for declaring an Oracle CEP high availability correlating output adapter is wlevs:adapter with provider element set to ha-correlating as Example 21-51 shows.

Example 21-51 Correlating Output Adapter EPN Assembly File

<wlevs:adapter id="myCorrelatingAdapter" provider="ha-correlating">
    <wlevs:listener>
        <bean class="com.bea.wlevs.example.cluster.ClusterAdapterBean"/>
    </wlevs:listener>
    <wlevs:instance-property name="correlatedSource" ref="clusterCorrOutstream"/>
    <wlevs:instance-property name="failOverDelay" value="2000"/>
</wlevs:adapter>

Table 21-10 describes the additional child elements of wlevs:adapter you can configure for an Oracle CEP high availability correlating output adapter.

Table 21-10 Child Elements of wlevs:adapter for the Correlating Output Adapter

Child Element Description

wlevs:listener

Specify the regular output adapter downstream from this Oracle CEP high availability buffering output adapter.

wlevs:instance-property

Specify one or more instance-property element name and value attributes as Table 21-11 describes.


Table 21-11 lists the instance properties that the Oracle CEP high availability correlating output adapter supports.

Table 21-11 Correlating Output Adapter Instance Properties

Name Value

correlatedSource

Specify the event source that will be used to correlate against. Events seen from this source will be purged from the trimming queue. Events still in the queue at failover will be replayed.

failOverDelay

Specify the delay timeout in milliseconds that is used to decide how soon after failover correlation should restart.

Default: 0 ms.


21.2.4.2 Correlating Output Adapter Component Configuration File Configuration

The root element for configuring an Oracle CEP high availability correlating output adapter is ha-correlating-adapter. The name child element for a particular adapter must match the id attribute of the corresponding wlevs:adapter element in the EPN assembly file that declares this adapter as Example 21-52 shows.

Example 21-52 Correlating Output Adapter Component Configuration File

<ha:ha-correlating-adapter>
    <name>myCorrelatingAdapter</name>
    <window-length>15000</window-length>
    <warm-up-window-length units="minutes">6</warm-up-window-length>
</ha:ha-correlating-adapter>

Table 21-12 describes the additional child elements of ha-broadcast-adapter you can configure for an Oracle CEP high availability correlating output adapter.

Table 21-12 Child Elements of ha-correlating-adapter for the Correlating Output Adapter

Child Element Description

fail-over-delay

Specify the delay timeout in milliseconds that is used to decide how soon after failover correlation should restart.

Default: 0 ms.

warm-up-window

Specify the length of time it takes the application to rebuild state after a previously failed secondary restarts or a new secondary is added as an integer number of units.

Valid values for attribute units:

  • seconds: wait the specified number of seconds.

  • minutes: wait the specified number of minutes.

Default: units is events.

For more information, see Section 20.3.2.5, "Choose an Adequate warm-up-window Time".