com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_link3' is unknown.

Setting up CEP Samples

See Overview of Samples to understand the general flow of CEP samples. Then follow the generic setup instructions below to execute the samples:



Prerequisites

SampleRequirements
All samples
  • Java Development Kit / JRE version 1.6.* or 1.7.*
  • Apache Ant 1.7.0 or later
JMS-related samples
  • Configure ActiveMQ or another JMS provider
  • If you use WSO2 Message Broker as the Input/Output JMS Event Adapter, copy the following JARs from Message Broker distribution directory to <CEP_HOME>/samples/lib directory:
    • < MB_HOME>/client-lib/ andes-client-xx.jar    
    • <MB_HOME>/client-lib/ geronimo-j2ee-management_1.1_spec-1.0.1xx.jar        
  • If you use Active MQ, copy the following JARs from ActiveMQ distribution directory to <CEP_HOME>/samples/lib directory:
    • <ActiveMQ_HOME>/activemq-all-5.7.0.jar
    • <ActiveMQ_HOME>/lib/ geronimo-jms_1.1_spec-1.1.1.jar      

Starting sample CEP configurations

To start the CEP with a sample configuration, run the following command with -sn <n>, where <n> denotes the number assigned to the sample.

On Linux: ./wso2cep-samples.sh -sn <n>
On Windows: wso2cep-samples.bat -sn <n> 

For example, to start the CEP with the configuration of sample 0101, run the following command inside <CEP_HOME>/bin directory:

On Linux: wso2cep-samples.sh -sn 0101 
On Windows: wso2cep-samples.bat -sn 0101

The <CEP_HOME>/samples/artifacts directory contains the sample configurations of CEP. Each configuration is inside a sub directory by the name of the sample numbered <n>. For example, the synapse configuration for sample 0101 is inside <CEP_HOME>/samples/artifacts/0101 directory.

 The <CEP_HOME>/bin/wso2server.bat or  <CEP_HOME>/bin/wso2server.sh  script starts an instance of the CEP using the Axis2 configuration files in <CEP_HOME>/repository/deployment/server directory and any sample configurations passed in as -sn <n> is ignored.

 

It is recommended to use WSO2 CEP in the sample mode only to run the samples, because the server has limited functionality in the sample mode. Thereby, the CEP dashboard application is not available when running CEP in the sample mode. However, if you need to use it in the sample mode, copy the <CEP_HOME>/repository/deployment/server/webapps/ and <CEP_HOME>/repository/deployment/server/jaggeryapps/ directories to the <CEP_HOME>/samples/artifacts/<SAMPLE_NUMBER>/ directory.

Starting sample consumers

Each sample consumer service is saved in a separate directory as <CEP_HOME>/samples/consumers/<consumer_name> .

  1. To start a sample consumer, go to its directory <CEP_HOME>/samples/consumers/<comsumer_name> and type ant. For example,

    user@host:/tmp/wso2cep-3.0.0/samples/consumers/wso2-event$ ant
    Buildfile: /home/usre/tmp/wso2cep-3.0.0/samples/consumers/wso2-event/build.xml
    ...
    run:[echo] To configure host, port and events use -Dhost=xxxx -Dport=xxx -Devents=xx
     [echo] Sending to : http://localhost:7661
                
     [java] Test Server starting on 10.100.0.75
     [java] Thrift Server started at 10.100.0.75
     [java] Thrift SSL port : 7761
     [java] Thrift port : 7661
     [java] Test Server Started

    To write a custom wso2Event data publisher (Thrift data publisher), use the pom file given here .

  2. Deploy the log service sample consumer, which is a Web service, by specifying the sample number as follows:

    ant -DsampleNo=<sample no>

    Running DsampleNo ant script deploys the log service in the axis2 repository that is relevant to the specified sample. After proper deployment, the Web service is able to receive messages from the CEP server.

    user@host:/tmp/wso2cep-3.0.0/samples/consumers/log-service$ ant -DsampleNo=0102
    Buildfile: /home/usre/tmp/wso2cep-3.0.0/samples/consumers/log-service/build.xml
    -folder.check:
    -assign.sample:
     [echo] Sample No : 0102
     [echo] Services Dir : ../../../samples/artifacts/0102/axis2services
    -assign.main:
    folder.set:
    clean:
    ...
    [jar] Building jar: /home/user/tmp/wso2cep-3.0.0/samples/artifacts/0102/axis2services/LogService.aar
    BUILD SUCCESSFUL
    Total time: 0 seconds
  3. For the log service consumer , g o to the CEP management console UI and create a topic using the Topics menu. Then create a subscription for that topic and specify the Event Sink URL as http://localhost:9763/services/LogService/log.

    As the topic name here, provide the same name specified in the event formatter configuration .

Starting sample producers

Starting a sample producer is similar to starting a consumer.

  1. Go to the sample producer's directory <CEP_HOME>/samples/producers/<producer_name> and type ant. For example,

    user@host:/tmp/wso2cep-3.0.0/samples/consumers/log-service$  ant pizzaOrderClient -Dservice=WSEventLocalAdaptorService 
    -Dtopic=BatchedPizzaOrder -DbatchedEvents=true
    Buildfile: /home/user/tmp/wso2cep-3.0.0/samples/producers/pizza-shop/build.xml
    init:
    compile:
    [copy] Copying 1 file to /home/user/tmp/wso2cep-3.0.0/samples/producers/pizza-shop/temp/classes
    pizzaOrderClient:
    [echo] To configure host and port use -Dhost=xxxx -Dport=xxx -Dservice=xxx -Dtopic=xxx
    [echo] Sending to : http://localhost:9763/services/WSEventLocalAdaptorService/BatchedPizzaOrder
                
    [echo] To send events in batches use -DbatchedEvents=true
    [echo] Sending events in batches : true
    BUILD SUCCESSFUL
    Total time: 1 second

Passing arguments to sample clients

Some sample clients take extra arguments. Given below is the format to pass arguments.

PurposeSyntaxExampleDefault
Specify the publishing topic for the producer client-Dtopic=XXXXant -Dtopic=AllStockQuotesAllStockQuotes
Publish to a specific host, which is an IP address-Dhost=XXXXant pizzaOrderClient -Dservice=WSEventLocalAdaptorService -Dtopic=BatchedPizzaOrder -DbatchedEvents=truelocalhost
Publish to a specific port-Dport=XXXXant pizzaOrderClient -Dport=97649763
Publish to a specific Web service-Dservice=XXXXant pizzaOrderClient -Dservice=wsInAdaptorServiceWSEventLocalAdaptorService
Send events in batches (i.e., the adapter receives a batch of events)-DbatchedEvents={true|false}ant -DbatchedEvents=true 
To subscribe events from a JMS topic (consumer)-Dtopic=XXXXXXant topicConsumer -Dtopic=TestTopicTestTopic
To subscribe events from a JMS queue (consumer)-Dqueue=XXXXXant queueConsumer -Dqueue=DelayedFlightStatsDelayedFlightStats

Setting up JMS for JMS sample clients

Before you run JMS samples, set up and start a JMS provider.

CEP samples are pre-configured to use an ActiveMQ 5.7.0 JMS server, which is set up locally. You can change this to another provider by editing the input/output event-adapter configuration in <CEP_HOME>/samples/artifacts/<sample_number>/inputeventadaptor or <CEP_HOME>/samples/artifacts/<sample_number>/outputeventadaptor directories. Also, copy the relevant JMS client libraries to <CEP_HOME>/samples/lib folder. For Apache ActiveMQ, the relevant JAR files are,

  • <ActiveMQ_HOME>/activemq-all-5.7.0.jar
  • <ActiveMQ_HOME>/ lib/ geronimo-jms_1.1_spec-1.1.1.jar

See JMS Transport to configure JMS transport for WSO2 CEP. 

Setting up Mail transport sender and receiver

The Mail transport sender is enabled by default in sample configurations. Point it to a valid SMTP configuration using <CEP_HOME>/ repository/conf/axis2/axis2_client.xml file as follows:

<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
	    <parameter name="mail.smtp.from">wso2cep.demo@gmail.com</parameter>
        <parameter name="mail.smtp.user">wso2cep.demo</parameter>
        <parameter name="mail.smtp.password">wso2cep@123</parameter>
        <parameter name="mail.smtp.host">smtp.gmail.com</parameter>
        <parameter name="mail.smtp.port">587</parameter>
        <parameter name="mail.smtp.starttls.enable">true</parameter>
        <parameter name="mail.smtp.auth">true</parameter>
</transportSender>

To enable the Mail transport receiver for samples, uncomment the following in axis2.xml file:

<transportReceiver name="mailto" class="org.apache.axis2.transport.mail.MailTransportListener">
</transportReceiver> 

In input event adapter, provide correct parameters of a valid mail account.

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.