The latest version for DAS is WSO2 Data Analytics Server 3.1.0. View documentation for the latest release.
WSO2 Data Analytics Server is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.

All docs This doc
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
||
Skip to end of metadata
Go to start of metadata

Introduction

This sample demonstrates how to set up an execution plan with a Siddhi query that monitors Twitter feeds of organizations using Siddhi partitions. It uses the following Siddhi query to check whether the word count of the Twitter feeds of each company within the last minute is greater than 10, and publishes the details of the companies with a high frequency of Twitter feeds as the output. This query has one incoming custom event stream of the word counts of various company names taken from Twitter pages. Custom events are events with custom mappings that do not adhere to the default event formats. For more information on event formats, see Event Formats

partition with (company of TwitterFeed) 
begin @info(name = 'query1') 
from TwitterFeed#window.time(1 min)
select company as company, sum(wordCount) as words 
having words > 10
insert into HighFrequentTweets;
end ;

Prerequisites

Set up the prerequisites required for all samples.

Building the sample

Start the WSO2 DAS server with the sample configuration numbered 0112. For instructions, see Starting sample CEP configurations.

This sample configuration creates the following.

  • Two streams with the IDs HighFrequentTweets:1.0.0 and twitterFeed:1.0.0.

  • An event receiver named WSO2EventReceiver.

  • An event publisher named HighFrequentTweetsLogger  to log the received messages. 

  • An execution plan named HighFrequentTweetsExecutionPlan.

Executing the sample

Navigate to the <DAS_HOME>/samples/cep/producers/wso2-event directory, and execute the following Ant command using another tab in the CLI.
ant -DstreamId=twitterFeed:1.0.0 -Dsn=0112

 

The other optional parameters that can be used in the above command are defined in the <DAS_HOME>/samples/cep/producers/wso2-event/build.xml file.

 

This builds and runs the WSO2Event producer that sends Twitter feed data to the DAS server. The details of the sent events are logged as shown below.

events published to the CEP serverDetails of the events received by the DAS server are logged in the CLI as shown below.

events received by the WSO2 CEP server

  • No labels