||
Skip to end of metadata
Go to start of metadata
By default, PPaaS 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 PPaaS. However, PPaaS uses CEP 3.1.0 when working with CEP externally.

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
  1. 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>
  2. Restart the PPaaS server without the internally embedded WSO2 CEP.

    sh wso2server.sh -Dprofile=cep-excluded
Step 2 - Configure CEP
  1. 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.

  2. 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>.
  3. 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. 
  4. 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
  5. 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
  6. 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
  7. 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

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

  9. Download the 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.
  10. 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
  11. 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
  12. 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:
  13. 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>
  14. 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
  15. 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, from RedundantMode to false.
  16. 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
  17. 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"
    }
  • No labels