Configuring WSO2 Complex Event Processor with PPaaS
Configuring CEP internally
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 <PRIVATE_PAAS_HOME>/repository/deployment/server/outputeventadaptors
directory, as follows:
property name="java.naming.provider.url">tcp://MB_HOSTNAME:MB_LISTEN_PORT</property>
Configuring CEP externally
Follow the instructions below to configure CEP with PPaaS as an external component:
Step 1 - Configure the Thrift client
Enable thrift stats publishing in the
thrift-client-config.xml
file, which is in the<PRIVATE_PAAS_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>
Restart the PPaaS server without the internally embedded WSO2 CEP.
sh wso2server.sh -Dprofile=cep-excluded
Step 2 - Configure 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.- Download the CEP extension from the PPaaS product page on the WSO2 website and uncompress the file. The extracted distribution is referred to as
<PPAAS_CEP_DISTRIBUTION>.
- Copy the following
stream-manager-config.xml
file from the<PPAAS_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 themessage-broker-ip
andmessage-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
<PPAAS_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
<PPAAS_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
- Download the
commons-lang3-3.4.jar
files from commons.apache.org andcommons-logging-1.2.jar
files from commons.apache.org. Copy the downloaded files to the<CEP_HOME>/repository/components/lib
directory. - Copy the following files from the
<PPAAS_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
- Copy the following file from the
<PPAAS_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
- Copy the
<PPAAS_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
andMB_LISTEN_PORT
with relevant values in theJMSOutputAdaptor.xml
file, which you copied in the above step, as follows:property name="java.naming.provider.url">tcp://MB_HOSTNAME:MB_LISTEN_PORT</property>
- Copy the following files from the
<PPAAS_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
- If you are setting up the external CEP in a single node, change the
siddhi.enable.distibuted.processing
property, in all the latter mentioned CEP 3.1.0 execution plans, fromRedundantMode
tofalse
. - Copy the following files from the
<PPAAS_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 Private PaaS 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" }