Introduction
This sample demonstrates how to filter some incoming event attributes and add to another topic using simple pass-through with JMS adaptor and WS-Event-Local adaptor. Because we do not use any execution plan here, there is no Siddhi query.
Prerequisites
- See Prerequisites in CEP Samples Setup page.
- If you use ActiveMQ, add the following JMS related JARs from ActiveMQ distribution directory to
<CEP_HOME>/repository/components/lib
directory. Also see JMS Transport for more information about required JARs.<ActiveMQ_HOME>/activemq-all-5.7.0.jar
<ActiveMQ_HOME>/lib/ geronimo-jms_1.1_spec-1.1.1.jar
Start the ActiveMQ server before the CEP server starts.
Building the Sample
Start the WSO2 CEP server with the sample number as ./wso2cep-samples.sh -sn 0003 (or on Windows, wso2cep-samples.bat -sn 0003). This will start up the server with the configuration files required for this samples.
Here when executing the sample with above command. There are some operations occurred in the backend. There is file called "stream-manager-config.xml" copied to the <CEP_HOME>/repository/conf from the artifacts directory of the sample. This file will be used in the server startup to create the stream definitions to run the sample.
Then, default Axis2 repo will be pointed to the directory <CEP_HOME>/sample/artifacts/0003 (by default Axis2 repo is <CEP_HOME>/repository/deployment/server). There will be limited functionality in sample server startup mode, then don't proceed much tasks in the server when it is start-up in the sample mode.
Executing the Sample
Open another terminal and switch to <CEP_HOME>/samples/consumers/log-service and run the below command. This will build the sample axis2 sample log service and deploy in the axis2 repository that is relevant to the specified sample. After proper deployment, the web service will be able to receive messages sent from the CEP server. Below you can see the logs in CEP server when LogService.aar is deploying.
ant -DsampleNo=0003
- Then, We need to Configure the LogService in order to receive the output events emitted by the CEP server under the PurchaseOrders topic. Here we will be creating PurchaseOrders topic in the local broker and subscribe LogService on that topic.
- Click on "Add" menu item under "Topics" Menu in Manage section of the left panel. Then Specify the topic name in the topic input text box, in this case topic name is : "PurchaseOrders" (the output topic) and click on 'Add Topic' button. This will add the topic to the server and you will be directed to the Topic Browser page.
- Once you click on the topic in topic browser page you will be able see four links as in the bellow image. Click in the subscribe link and you will be directed to Subscribe page.
- Create subscription with following details. Once you are done click the Subscribe button.
- Now subscription to the specific topic is done. Now we can send events to CEP.
From another terminal switch to <CEP_HOME>/samples/producers/purchase-info/ and run ant from there. This will build and run the jms producer which will send some purchase information to the CEP server. From this terminal, you will be able to view the details of the events sent. Below is the sample screen shot when sending events.
Below is the console output in the CEP server when events are received after processing.