By default, Stratos is shipped with an embedded WSO2 Complex Event Processor (CEP). It is recommended to use the embedded CEP only for testing purposes and to configure CEP externally in a production environment. Furthermore, the compatible CEP versions differ based on whether the CEP is internal or external. WSO2 CEP 3.0.0 is embedded into Stratos. However, Stratos uses CEP 3.1.0 when working with CEP externally.
Follow the instructions below to configure the embedded CEP:
Update the MB_HOSTNAME
and MB_LISTEN_PORT
with relevant values in the JMSOutputAdaptor.xml
file, which is in the <STRATOS_HOME>/repository/deployment/server/outputeventadaptors
directory, as follows:
property name="java.naming.provider.url">tcp://MB_HOSTNAME:MB_LISTEN_PORT</property>
Follow the instructions below to configure CEP with Stratos as an external component:
Enable thrift stats publishing in the thrift-client-config.xml
file, which is in the <STRATOS_HOME>/repository/conf
directory. Here you can set multiple CEP nodes for a High Availability (HA) setup.
<cep> <node id="node-01"> <statsPublisherEnabled>true</statsPublisherEnabled> <username>admin</username> <password>admin</password> <ip>localhost</ip> <port>7611</port> </node> <!--<node id="node-02"> <statsPublisherEnabled>true</statsPublisherEnabled> <username>admin</username> <password>admin</password> <ip>10.10.1.1</ip> <port>7714</port> </node>--> </cep>
If you are configuring the external CEP in the High Availability (HA) mode, create a CEP HA deployment cluster in full-active-active mode. Note that it is recommended to setup CEP in a HA mode.
Skip this step if you are setting up the external CEP in a single node.
For more information on CEP clustering see the CEP clustering guide.
When following the steps in the CEP clustering guide, note that you need to configure all the CEP nodes in the cluster as mentioned in step 3 and only then carryout the preceding steps.
<STRATOS_CEP_DISTRIBUTION>.
stream-manager-config.xml
file from the <STRATOS_CEP_DISTRIBUTION>/wso2cep-3.1.0/streamdefinitions
directory to the <CEP_HOME>/repository/conf
directory. Replace the content in the jndi.properties
file, which is in the <CEP_HOME>/repository/conf
directory, with the following configurations. Update the message-broker-ip
and message-broker-port
values.
connectionfactoryName=TopicConnectionFactory java.naming.provider.url=tcp://[MB_IP]:[MB_Port] java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory # register some topics in JNDI using the form # topic.[jndiName]=[physicalName] topic.lb-stats=lb-stats topic.instance-stats=instance-stats topic.summarized-health-stats=summarized-health-stats topic.topology=topology topic.ping=ping
Add the following content to the siddhi.extension
file, which is in the <CEP_HOME>/repository/conf/siddhi
directory.
org.apache.stratos.cep.extension.GradientFinderWindowProcessor org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor org.apache.stratos.cep.extension.FaultHandlingWindowProcessor org.apache.stratos.cep.extension.ConcatWindowProcessor org.apache.stratos.cep.extension.MemeberRequestHandlingCapabilityWindowProcessor org.apache.stratos.cep.extension.SystemTimeWindowProcessor
Copy the following JARs, which are in the <STRATOS_CEP_DISTRIBUTION>/wso2cep-3.1.0/lib
directory to the <CEP_HOME>/repository/components/lib
directory.
org.apache.stratos.cep.310.extension-4.1.5.jar
Copy the following JARs, which are in the <STRATOS_CEP_DISTRIBUTION>/lib
directory to the <CEP_HOME>/repository/components/lib
directory.
org.apache.stratos.messaging-4.1.x.jar
org.apache.stratos.common-4.1.x.jar
Download any dependencies on ActiveMQ 5.10.0 or the latest stable ActiveMQ TAR file from activemq.apache.org. The folder path of this file is referred to as <ACTIVEMQ_HOME>
. Copy the following ActiveMQ client JARSs from the <ACTIVEMQ_HOME>
/lib
directory to the <CEP_HOME>/repository/components/lib
directory.
activemq-broker-5.10.0.jar
activemq-client-5.10.0.jar
geronimo-j2ee-management_1.1_spec-1.0.1.jar
geronimo-jms_1.1_spec-1.1.1.jar
hawtbuf-1.10.jar
commons-lang3-3.4.jar
files from commons.apache.org and commons-logging-1.2.jar
files from commons.apache.org. Copy the downloaded files to the <CEP_HOME>/repository/components/lib
directory.<STRATOS_CEP_DISTRIBUTION>/wso2cep-3.1.0/eventbuilders
directory, which you downloaded in step 2.2, to the <CEP_HOME>/repository/deployment/server/eventbuilders
directory:HealthStatisticsEventBuilder.xml
LoadBalancerStatisticsEventBuilder.xml
<STRATOS_CEP_DISTRIBUTION>/wso2cep-3.1.0/inputeventadaptors
directory, which you downloaded in step 2.2, to the <CEP_HOME>/repository/deployment/server/inputeventadaptors
directory:DefaultWSO2EventInputAdaptor.xml
<STRATOS_CEP_DISTRIBUTION>/wso2cep-3.1.0/outputeventadaptors/JMSOutputAdaptor.xml
file, which you downloaded in step 2.2, to the <CEP_HOME>/repository/deployment/server/outputeventadaptors
directory:Update the MB_HOSTNAME
and MB_LISTEN_PORT
with relevant values in the JMSOutputAdaptor.xml
file, which you copied in the above step, as follows:
property name="java.naming.provider.url">tcp://MB_HOSTNAME:MB_LISTEN_PORT</property>
<STRATOS_CEP_DISTRIBUTION>/wso2cep-3.1.0/executionplans
directory, which you downloaded in step 2.2, to the <CEP_HOME>/repository/deployment/server/executionplans
directory:AverageHeathRequest.xml
AverageInFlightRequestsFinder.xml
GradientOfHealthRequest.xml
GradientOfRequestsInFlightFinder.xml
SecondDerivativeOfHealthRequest.xml
SecondDerivativeOfRequestsInFlightFinder.xml
siddhi.enable.distibuted.processing
property, in all the latter mentioned CEP 3.1.0 execution plans, from RedundantMode
to false
.<STRATOS_CEP_DISTRIBUTION>/wso2cep-3.1.0/eventformatters
directory, which you downloaded in step 2.2, to the <CEP_HOME>/repository/deployment/server/eventformatters
directory:AverageInFlightRequestsEventFormatter.xml
AverageLoadAverageEventFormatter.xml
AverageMemoryConsumptionEventFormatter.xml
FaultMessageEventFormatter.xml
GradientInFlightRequestsEventFormatter.xml
GradientLoadAverageEventFormatter.xml
GradientMemoryConsumptionEventFormatter.xml
MemberAverageLoadAverageEventFormatter.xml
MemberAverageMemoryConsumptionEventFormatter.xml
MemberGradientLoadAverageEventFormatter.xml
MemberGradientMemoryConsumptionEventFormatter.xml
MemberSecondDerivativeLoadAverageEventFormatter.xml
MemberSecondDerivativeMemoryConsumptionEventFormatter.xml
SecondDerivativeInFlightRequestsEventFormatter.xml
SecondDerivativeLoadAverageEventFormatter.xml
SecondDerivativeMemoryConsumptionEventFormatter.xml
Add the CEP URLs as a payload parameter to the network partition.
If you are deploying Stratos on Kubernetes, then add the CEP URLs to the Kubernetes cluster.
Example:
{ "name": "payload_parameter.CEP_URLS", "value": "192.168.0.1:7712,192.168.0.2:7711" }
Update the following configuration and artifact files in the Complex Event Processor (CEP):
carbon.xml
file, which is found in the <CEP_HOME>/repository/conf/
directory as follows: <offset>4</offset>
stream-manager-config.xml
file from the <STRATOS_SOURCE_HOME>/extensions/cep/artifacts/stream_definitions
directory to <CEP_HOME>/repository/conf
directory. Where <STRATOS_SOURCE_HOME>
refers to the Apache Stratos source repository.Replace the content in the jndi.properties
file, which is in the <CEP_HOME>/repository/conf
directory, with the following configurations. Update the message-broker-ip
and message-broker-port
values.
connectionfactoryName=TopicConnectionFactory java.naming.provider.url=tcp://[MB_IP]:[MB_Port] java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory # register some topics in JNDI using the form # topic.[jndiName]=[physicalName] topic.lb-stats=lb-stats topic.instance-stats=instance-stats topic.summarized-health-stats=summarized-health-stats topic.topology=topology topic.ping=ping
Add the following content to the siddhi.extension
file, which is in the <CEP_HOME>/repository/conf/siddhi
directory.
org.apache.stratos.cep.extension.GradientFinderWindowProcessor org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor org.apache.stratos.cep.extension.FaultHandlingWindowProcessor org.apache.stratos.cep.extension.ConcatWindowProcessor org.apache.stratos.cep.extension.MemeberRequestHandlingCapabilityWindowProcessor
<STRATOS_SOURCE_HOME>/extensions/cep/stratos-cep-extension
directory. Thereafter, copy the org.apache.stratos.cep.extension-4.1.x.jar
file that can be found in the <STRATOS_SOURCE_HOME>/extensions/cep/stratos-cep-extension/target
directory, to the <CEP_HOME>/repository/components/lib/
directory.Download any dependency on 5.9.1 or any latest stable ActiveMQ TAR file from https://activemq.apache.org/download.html. The folder path of this file will be referred to as <ACTIVEMQ_HOME>
. Copy the following ActiveMQ client JARSs from <ActiveMQ_HOME>
/lib
directory to the <CEP_HOME>/repository/components/lib
directory.
activemq-broker-5.9.1.jar
activemq-client-5.9.1.jar
geronimo-j2ee-management_1.1_spec-1.0.1.jar
geronimo-jms_1.1_spec-1.1.1.jar
hawtbuf-1.9.jar
<CEP_HOME>/repository/components/dropins
directory.andes-client-0.13.wso2v8.1.jar
geronimo-jms_1.1_spec-1.1.0.wso2v1.jar
commons-lang3-3.4.jar
files from commons.apache.org and commons-logging-1.2.jar
files from commons.apache.org. Copy the downloaded files to the <CEP_HOME>/repository/components/lib
directory. <STRATOS_SOURCE_HOME>/extensions/cep/artifacts/eventbuilders
directory to the <CEP_HOME>/repository/deployment/server/eventbuilders
directory:HealthStatisticsEventBuilder.xml
InstanceStatisticsEventBuilder.xml
LoadBalancerStatisticsEventBuilder.xml
<CEP_HOME>/repository/components/lib
directory.org.apache.stratos.messaging-4.1.x-SNAPSHOT.jar
file in the <STRATOS_SOURCE_HOME>/components/org.apache.stratos.messaging/target
directory.org.apache.stratos.common-4.1.x-SNAPSHOT.jar
file in the <STRATOS_SOURCE_HOME>/components/org.apache.stratos.common/target
directory.
<STRATOS_SOURCE_HOME>/extensions/cep/artifacts/inputeventadaptors/
directory to the <CEP_HOME>/repository/deployment/server/inputeventadaptors
directory:DefaultWSO2EventInputAdaptor.xml
<STRATOS_SOURCE_HOME>/extensions/cep/artifacts/outputeventadaptors
directory to the <CEP_HOME>/repository/deployment/server/outputeventadaptors
directory:DefaultWSO2EventOutputAdaptor.xml
JMSOutputAdaptor.xml
Update the MB_HOSTNAME
and MB_LISTEN_PORT
with relevant values in the JMSOutputAdaptor.xml
file that was copied in the above step, as follows:
property name="java.naming.provider.url">tcp://MB_HOSTNAME:MB_LISTEN_PORT</property>
<STRATOS_SOURCE_HOME>/extensions/cep/artifacts/executionplans
directory to the <CEP_HOME>/repository/deployment/server/executionplans
directory:AverageHeathRequest.xml
AverageInFlightRequestsFinder.xml
GradientOfHealthRequest.xml
GradientOfRequestsInFlightFinder.xml
SecondDerivativeOfHealthRequest.xml
SecondDerivativeOfRequestsInFlightFinder.xml
<STRATOS_SOURCE_HOME>/extensions/cep/artifacts/eventformatters
directory to the <CEP_HOME>/repository/deployment/server/eventformatters
directory:AverageInFlightRequestsEventFormatter.xml
AverageLoadAverageEventFormatter.xml
AverageMemoryConsumptionEventFormatter.xml
FaultMessageEventFormatter.xml
GradientInFlightRequestsEventFormatter.xml
GradientLoadAverageEventFormatter.xml
GradientMemoryConsumptionEventFormatter.xml
MemberAverageLoadAverageEventFormatter.xml
MemberAverageMemoryConsumptionEventFormatter.xml
MemberGradientLoadAverageEventFormatter.xml
MemberGradientMemoryConsumptionEventFormatter.xml
MemberSecondDerivativeLoadAverageEventFormatter.xml
MemberSecondDerivativeMemoryConsumptionEventFormatter.xml
SecondDerivativeInFlightRequestsEventFormatter.xml
SecondDerivativeLoadAverageEventFormatter.xml
SecondDerivativeMemoryConsumptionEventFormatter.xml