This chapter describes how to configure scalability for your Oracle CEP application depending on the quality of service you have selected, including:
Section 19.1, "How to Configure Scalability With an Event Partitioner Channel"
Section 19.2, "Configuring Scalability With the ActiveActiveGroupBean"
For more information on scalability options, see Chapter 18, "Understanding Scalability".
This section describes how to configure a channel with an Oracle CEP event partitioner.
For more information, see Section 18.2.2, "Event Partitioner Channel"'.
To configure scalability with an event partitioner channel;
Add a channel to your EPN.
For more information, see Chapter 8, "Configuring Channels".
Connect the channel to two or more identical listeners.
For example, connect the channel to two or more Oracle CQL processors, each configured with the same Oracle CQL rules.
For more information, see Section 5.4.2, "Connecting Nodes".
Edit the EPN assembly file to configure the channel as follows:
Set max-threads
to 0.
The channel acts as a pass-through. Event ordering is preserved.
Example 19-1 shows such a channel.
Example 19-1 Channel Configuration for Event Partitioning
...
<wlevs:channel id="priceStream" event-type="PriceEvent" max-threads="0" >
<wlevs:listener ref="filterFanoutProcessor1" />
<wlevs:listener ref="filterFanoutProcessor2" />
<wlevs:listener ref="filterFanoutProcessor3" />
<wlevs:source ref="PriceAdapter" />
</wlevs:channel>
...
Edit the EPN assembly file to add an eventPartitioner
instance property to the channel element as Example 19-2 shows.
Example 19-2 Channel eventPartioner Instance Property
...
<wlevs:channel id="priceStream" event-type="PriceEvent" max-threads="0" >
<wlevs:instance-property name="eventPartitioner" value="true" />
<wlevs:listener ref="filterFanoutProcessor1" />
<wlevs:listener ref="filterFanoutProcessor2" />
<wlevs:listener ref="filterFanoutProcessor3" />
<wlevs:source ref="PriceAdapter" />
</wlevs:channel>
...
Assemble and deploy your application.
For more information, see Chapter 20, "Assembling and Deploying Oracle CEP Applications".
At runtime, the Oracle CEP server dispatches each incoming event to a different listener.
This section describes how to configure your Oracle CEP application to use the ActiveActiveGroupBean
to partition an incoming JMS event stream by selector, including:
For more information, see Section 18.2.1, "ActiveActiveGroupBean".
You can use the ActiveActiveGroupBean
to partition an incoming JMS event stream by selector in a multi-server domain for an application that does not use Oracle CEP high availability.
For information on how to use the ActiveActiveGroupBean
in an Oracle CEP high availability application, see Section 19.2.2, "How to Configure Scalability in a JMS Application With Oracle CEP High Availability".
For more information, see Section 18.2.1.1, "Scalability in an Oracle CEP Application Using the ActiveActiveGroupBean Without High Availability".
To configure scalability in a JMS application without Oracle CEP high availability:
Create a multi-server domain.
For more information, see "Introduction to Multi-Server Domains" in the Oracle CEP Administrator's Guide.
In this example, the deployment group is named MyDeploymentGroup
.
Configure the Oracle CEP server configuration file on each Oracle CEP server to add the appropriate ActiveActiveGroupBean
notification group to the groups
child element of the cluster
element.
The Oracle CEP server configuration file, config.xml
, is located in the DOMAIN_DIR
/
servername
/config
directory, where DOMAIN_DIR
refers to the main domain directory and servername
refers to a particular server instance.
For example, Table 19-2 shows cluster
elements for Oracle CEP servers ocep-server-1
, ocep-server-2
, ocep-server-3
, and ocep-server-4
. The deployment group is MyDeploymentGroup
and notification groups are defined using default ActiveActiveGroupBean
notification group naming.
Optionally, you can specify your own group naming convention as Section 19.2.3, "How to Configure the ActiveActiveGroupBean Group Pattern Match" describes.
Table 19-1 Oracle CEP Server Configuration File groups Element Configuration
Partition | cluster Element |
---|---|
|
<cluster> <server-name>ocep-server-1</server-name> ... <enabled>coherence</enabled> ... <groups>MyDeploymentGroup, ActiveActiveGroupBean_group1</groups> </cluster> |
|
<cluster> <server-name>ocep-server-2</server-name> ... <enabled>coherence</enabled> ... <groups>MyDeploymentGroup, ActiveActiveGroupBean_group2</groups> </cluster> |
|
<cluster> <server-name>ocep-server-3</server-name> ... <enabled>coherence</enabled> ... <groups>MyDeploymentGroup, ActiveActiveGroupBean_group3</groups> </cluster> |
|
<cluster> <server-name>ocep-server-4</server-name> ... <enabled>coherence</enabled> ... <groups>MyDeploymentGroup, ActiveActiveGroupBean_group4</groups> </cluster> |
Create an Oracle CEP application.
Configure the EPN assembly file to add an ActiveActiveGroupBean
element as Example 19-7 shows.
Define a parameterized message-selector
in the jms-adapter
element for the JMS inbound adapters.
Edit the component configuration file to add group-binding
child elements to the jms-adapter
element for the JMS inbound adapters.
Add one group-binding
element for each possible JMS message-selector value as Example 19-9 shows.
Example 19-4 jms-adapter Selector Definition for ocep-server-1
<jms-adapter> <name>JMSInboundAdapter</name> <event-type>StockTick</event-type> <jndi-provider-url>t3://ppurich-pc:7001</jndi-provider-url> <destination-jndi-name>./Topic1</destination-jndi-name> <user>weblogic</user> <password>weblogic1</password> <work-manager>JettyWorkManager</work-manager> <concurrent-consumers>1</concurrent-consumers> <session-transacted>true</session-transacted> <message-selector>${CONDITION}</message-selector> <bindings> <group-binding group-id="ActiveActiveGroupBean_group1"> <param id="CONDITION">acctid > 400</param> </group-binding> <group-binding group-id="ActiveActiveGroupBean_group2"> <param id="CONDITION">acctid BETWEEN 301 AND 400</param> </group-binding> <group-binding group-id="ActiveActiveGroupBean_group3"> <param id="CONDITION">acctid BETWEEN 201 AND 300</param> </group-binding> <group-binding group-id="ActiveActiveGroupBean_group4"> <param id="CONDITION">acctid <= 200</param> </group-binding> </bindings> </jms-adapter>
In this configuration, when the application is deployed to an Oracle CEP server with a cluster
element groups
child element that contains ActiveActiveGroupBean_group1
, then the CONDITION
parameter is defined as acctid > 400
and the application processes events whose acctid
property is greater than 400.
Note:
Each in-bound JMS adapter must listen to a different topic.For more information, see Chapter 6, "Configuring JMS Adapters".
Deploy your application to the deployment group of your multi-server domain.
For more information, see Chapter 20, "Assembling and Deploying Oracle CEP Applications".
At runtime, each Oracle CEP server configures its instance of the application with the message-selector
that corresponds to its ActiveActiveGroupBean
notification group. This partitions the JMS topic so that each instance of the application processes a subset of the total number of messages in parallel.
You can use the ActiveActiveGroupBean
to partition an incoming JMS event stream in a multi-server domain with Oracle CEP high availability.
This procedure uses the example application from Section 17.1.4, "How to Configure Precise Recovery With JMS", including the example EPN that Figure 19-1 shows, the corresponding EPN assembly file that Example 19-5 shows, and the corresponding component configuration file that Example 19-6 shows.
Figure 19-1 Precise Recovery With JMS EPN
Example 19-5 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:channel id="channel2" event-type="StockTick"> <wlevs:listener ref="myHaCorrelatingAdapter" /> </wlevs:channel> <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: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 19-6 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> <jms-adapter> <name>JMSInboundAdapter</name> <event-type>StockTick</event-type> <jndi-provider-url>t3://ppurich-pc:7001</jndi-provider-url> <destination-jndi-name>./Topic1</destination-jndi-name> <session-transacted>true</session-transacted> ... </jms-adapter> <jms-adapter> <name>JMSInboundAdapter2</name> <event-type>StockTick</event-type> <jndi-provider-url>t3://ppurich-pc:7001</jndi-provider-url> <destination-jndi-name>./Topic2</destination-jndi-name> <session-transacted>true</session-transacted> ... </jms-adapter> <jms-adapter> <name>JMSOutboundAdapter</name> <event-type>StockTick</event-type> <jndi-provider-url>t3://ppurich-pc:7001</jndi-provider-url> <destination-jndi-name>./Topic2</destination-jndi-name> <session-transacted>true</session-transacted> ... </jms-adapter> </wlevs:config>
This procedure will create the Oracle CEP high availability configuration that Figure 19-2 shows.
Figure 19-2 Oracle CEP ActiveActiveGroupBean With High Availability
For more information, see Section 18.2.1.2, "Scalability in an Oracle CEP Application Using the ActiveActiveGroupBean With High Availability".
To configure scalability in a JMS application with Oracle CEP high availability:
Create a multi-server domain.
For more information, see "Introduction to Multi-Server Domains" in the Oracle CEP Administrator's Guide.
In this example, the deployment group is named MyDeploymentGroup
.
Configure the Oracle CEP server configuration file on each Oracle CEP server to add the appropriate ActiveActiveGroupBean
notification group to the groups
child element of the cluster
element.
The Oracle CEP server configuration file, config.xml
, is located in the DOMAIN_DIR
/
servername
/config
directory, where DOMAIN_DIR
refers to the main domain directory and servername
refers to a particular server instance.
For example, Table 19-2 shows cluster
elements for Oracle CEP servers ocep-server-1
, ocep-server-2
, ocep-server-3
, and ocep-server-4
. The deployment group is MyDeploymentGroup
and notification groups are defined using default ActiveActiveGroupBean
notification group names.
Note that ocep-server-1
and ocep-server-2
use the same notification group name (ActiveActiveGroupBean_group1
) and ocep-server-3
and ocep-server-4
use the same notification group name (ActiveActiveGroupBean_group2
).
Optionally, you can specify your own group naming convention as Section 19.2.3, "How to Configure the ActiveActiveGroupBean Group Pattern Match" describes.
Table 19-2 Oracle CEP Server Configuration File groups Element Configuration
Partition | cluster Element |
---|---|
|
<cluster> <server-name>ocep-server-1</server-name> ... <enabled>coherence</enabled> ... <groups>MyDeploymentGroup, ActiveActiveGroupBean_group1</groups> </cluster> |
|
<cluster> <server-name>ocep-server-2</server-name> ... <enabled>coherence</enabled> ... <groups>MyDeploymentGroup, ActiveActiveGroupBean_group1</groups> </cluster> |
|
<cluster> <server-name>ocep-server-3</server-name> ... <enabled>coherence</enabled> ... <groups>MyDeploymentGroup, ActiveActiveGroupBean_group2</groups> </cluster> |
|
<cluster> <server-name>ocep-server-4</server-name> ... <enabled>coherence</enabled> ... <groups>MyDeploymentGroup, ActiveActiveGroupBean_group2</groups> </cluster> |
Create an Oracle CEP high availability application.
For more information, see Chapter 17, "Configuring High Availability".
Configure the EPN assembly file to add an ActiveActiveGroupBean
element as Example 19-7 shows.
Edit the component configuration file to configure a jms-adapter element for the inbound JMS adapters as Example 19-8 shows:
Each in-bound JMS adapter must listen to a different topic.
Set session-transacted
to true
.
Example 19-8 jms-adapter Element for Inbound JMS 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/"> ... <jms-adapter> <name>JMSInboundAdapter</name> <event-type>StockTick</event-type> <jndi-provider-url>t3://ppurich-pc:7001</jndi-provider-url> <destination-jndi-name>./Topic1</destination-jndi-name> <session-transacted>true</session-transacted> ... </jms-adapter> <jms-adapter> <name>JMSInboundAdapter2</name> <event-type>StockTick</event-type> <jndi-provider-url>t3://ppurich-pc:7001</jndi-provider-url> <destination-jndi-name>./Topic2</destination-jndi-name> <session-transacted>true</session-transacted> ... </jms-adapter> </wlevs:config>
For more information, see Chapter 6, "Configuring JMS Adapters".
Define a parameterized message-selector
in the jms-adapter
element for each JMS inbound adapter.
Edit the component configuration file to add group-binding
child elements to the jms-adapter
element for the JMS inbound adapters.
Add one group-binding
element for each possible JMS message-selector
value as Example 19-9 shows.
Example 19-9 jms-adapter Selector Definition for ocep-server-1
<jms-adapter> <name>JMSInboundAdapter</name> <event-type>StockTick</event-type> <jndi-provider-url>t3://ppurich-pc:7001</jndi-provider-url> <destination-jndi-name>./Topic1</destination-jndi-name> <session-transacted>true</session-transacted> <message-selector>${CONDITION}</message-selector> <bindings> <group-binding group-id="ActiveActiveGroupBean_group1"> <param id="CONDITION">acctid <= 1000</param> </group-binding> <group-binding group-id="ActiveActiveGroupBean_group2"> <param id="CONDITION">acctid > 1000</param> </group-binding> </bindings> </jms-adapter>
In this configuration, when the application is deployed to an Oracle CEP server with a cluster
element groups
child element that contains ActiveActiveGroupBean_group1
, then the CONDITION
parameter is defined as acctid <= 1000
and the application processes events whose acctid
property is less than or equal to 1000. Similarily, when the application is deployed to an Oracle CEP server with a cluster
element groups
child element that contains ActiveActiveGroupBean_group2
, then the CONDITION
parameter is defined as acctid > 1000
and the application processes events whose acctid
property is greater than 1000.
Edit the component configuration file to configure a jms-adapter
element for the outbound JMS adapter as Example 19-10 shows:
Configure the out-bound JMS adapter with the same topic as the correlating in-bound adapter (in this example, JMSInboundAdapter2
: ./Topic2
).
Set session-transacted
to true
.
Example 19-10 jms-adapter Element for Outbound JMS 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/"> ... <jms-adapter> <name>JMSInboundAdapter</name> <event-type>StockTick</event-type> <jndi-provider-url>t3://ppurich-pc:7001</jndi-provider-url> <destination-jndi-name>./Topic1</destination-jndi-name> <session-transacted>true</session-transacted> ... </jms-adapter> <jms-adapter> <name>JMSInboundAdapter2</name> <event-type>StockTick</event-type> <jndi-provider-url>t3://ppurich-pc:7001</jndi-provider-url> <destination-jndi-name>./Topic2</destination-jndi-name> <session-transacted>true</session-transacted> ... </jms-adapter> <jms-adapter> <name>JMSOutboundAdapter</name> <event-type>StockTick</event-type> <jndi-provider-url>t3://ppurich-pc:7001</jndi-provider-url> <destination-jndi-name>./Topic2</destination-jndi-name> <session-transacted>true</session-transacted> ... </jms-adapter> </wlevs:config>
For more information, see Chapter 6, "Configuring JMS Adapters".
Deploy your application to the deployment group of your multi-server domain.
For more information, see Chapter 20, "Assembling and Deploying Oracle CEP Applications".
At runtime, each Oracle CEP server configures its instance of the application with the message-selector
that corresponds to its ActiveActiveGroupBean
notification group. This partitions the JMS topic so that each instance of the application processes a subset of the total number of messages in parallel.
If the active Oracle CEP server in an ActiveActiveGroupBean
group goes down, the Oracle CEP server performs an Oracle CEP high availability failover to the standby Oracle CEP server in that ActiveActiveGroupBean
group.
By default, the ActiveActiveGroupBean
creates notification groups named:
ActiveActiveGroupBean_X
Where X
is a string.
At runtime, the ActiveActiveGroupBean
scans the existing groups defined on the Oracle CEP server and applies a default pattern match of:
ActiveActiveGroupBean_\\w+
When it finds a match, it creates a notification group of that name.
Optionally, you can define your own group pattern to specify a different notification group naming pattern.
How to configure the ActiveActiveGroupBean group pattern match:
Configure the EPN assembly file to add a groupPattern
attribute to your ActiveActiveGroupBean
element as Example 19-11 shows.
Specify a value for the groupPattern
attribute that matches the cluster group naming convention you want to use for notification groups.