Skip to main content

WSO2 DAS - Hello World!

https://www.javahelps.com/2015/11/wso2-cep-hello-world.html

WSO2 Data Analytics Server is a smart analytics platform for both real-time and batch analytics. The real-time analytics is provided through their powerful open source Complex Event Processing Engine engine Siddhi. This article focuses on the complex event processing capability of the DAS server and provides a quick start guide on how to setup an event stream and process events generated by an HTTP source.
WSO2 DAS - Hello World!
Prerequisite:
Oracle JDK 1.7 or latest
Memory – Minimum 2GB
Disk – Minimum 1 GB
For more details: Installation Prerequisites


Step 1:
Download and extract the latest version of WSO2 DAS from the official link: WSO2 Smart Analytics

Step 2:
Install Postman in Google chrome. We will use Postman to send HTTP requests to the CEP. You can use any other HTTP clients for this purpose.

Step 3:
Open your terminal in wso2das-x.x.x folder and execute the following command.
Linux users:
./bin/wso2server.sh

Windows users:
.\bin\wso2server.bat

Step 4:
Visit the "Mgt Console URL" which is printed in the Terminal. In my computer, this URL is: https://192.168.122.1:9443/carbon/ but it may vary depending on the system.

The browser may show an alert since the local server does not contain a valid HTTPS certificate, click on 'Proceed to <IP-Address>' link.

WSO2 DAS - Hello World!

Step 5:
Login to the dashboard using username: admin and password: admin.

Step 6:
Go to the Streams tab and click on “Add Event Stream” link.

WSO2 DAS - Hello World!


Step 7:
Provide the stream name as “TemperatureStream” and add a payload attribute “temp” as shown below.

WSO2 DAS - Hello World!

Step 8:
Add another stream named “PeakTemperatureStream” with a payload data “temp”.

WSO2 DAS - Hello World!

Step 9:
Open the “Execution Plans” tab and click on “Add Execution Plan” link.

WSO2 DAS - Hello World!


Step 10:
Import the TemperatureStream and Export the PeakTemperatureStream using their own names.

WSO2 DAS - Hello World!

Step 11:
Append the following query at the end of the existing query statements.
from TemperatureStream#window.timeBatch( 1 minute )
select max(temp) as temp
insert into PeakTemperatureStream
This query will collect the events from TemeratureStream and insert the maximum temperature of every minute into the PeakTemperatureStream.

WSO2 DAS - Hello World!
Validate your query expressions and add the execution plan.

Step 12:
Go to the “Receivers” tab and click on the “Add Event Receiver” link.

WSO2 DAS - Hello World!


Step 13:
Create a new HTTP event receiver to receive the TemperatureStream with a name “TemperatureReceiver” and format “json”.

WSO2 DAS - Hello World!

This receiver will receive HTTP requests and pass the event details to the TemperatureStream.

Step 14:
Now we need to create a publisher to publish the peak temperature. Go to the “Publishers” tab and click on the “Add Event Publisher” link.

WSO2 DAS - Hello World!

Step 15:
Create a new logger event publisher for PeakTemperatureStream with a name “TemperaturePublisher”.

WSO2 DAS - Hello World!

This publisher will print the events inserted into the PeakTemperatureStream using the built-in logger.

Step 16:
Now we have two event streams, an event receiver, an executor and a publisher. In Siddhi you can have multiple receivers and publishers for the same stream. Now this the time to send some events and to test the CEP engine.

Open the Postman and send few POST HTTP requests to:
http://localhost:9763/endpoints/TemperatureReceiver
with the TemperatureStream event as a JSON message. Send few numbers of requests with different temperatures.

JSON input:
{
    "event": {
        "payloadData": {
            "temp": 15.6
        }
    }
}

WSO2 DAS - Hello World!

Step 17:
Go the Terminal which is running the wso2server. At the bottom, you will see the maximum temperature value you have sent within the last minute.

WSO2 DAS - Hello World!

Note:
The query used here and the event publisher to the logger are chosen to simplify your first step. You have the freedom to try other event receivers and publishers according to your requirement.

If you have any doubts or problems regarding this article, feel free to comment below.

Comments

Popular posts from this blog

web2apk

http://web2apk.com/create.aspx Create App   Intro   About   Changes   MalWare ?   Contact   Privacy Useful Links Bluetooth Mini Keyboards Android Mini PC Reset Android URL App Title Icon or

Android Bar Chart Using MpAndroidChart Library Tutorial

https://www.numetriclabz.com/android-bar-chart-using-mpandroidchart-library-tutorial/ Android Bar Chart Using MpAndroidChart Library Tutorial Objective In this tutorial we learn how to implement Bar Chart using MpAndroidChart Library in your Android App. Download Source Code       Step 1 Contents ·        1  Introduction ·        2  Creating Bar chart o    2.1  Create a new Project o    2.2  Adding library in Project o    2.3  Create Layout o    2.4  To Plot Bar Chart §   2.4.1  Initialize the graph id §   2.4.2  Creating a Dataset §   2.4.3  Defining X-axis labels §   2.4.4  Set the data §   2.4.5  Add the description to the chart §   2.4.6  Run your App §   2.4.7  Set the color §   2.4.8  Adding Animations o    2.5  To plot grouped bar chart §   2.5.1  Creating Dataset o    2.6  Get the best of Android plus exclusive deals and freebies in your inbox!

how to retrieve image from sqlite database in android and display in listview

 Android platform provides several ways to store data in our application. 1. SQLite database 2. SharedPreferences etc For our post, we will only work with SQLite database. First and foremost, we need to understand what an SQLite database is? SQLite database  is an open source SQL database that stores data to a text file on a device. It executes SQL Commands to perform a set of functions, that is, create, read, update and delete operations. On my previous post, I showed how to  store data in SQLite database from edit text, retrieve and populate it in a listview . For this post, I will show the SQLite CRUD operations with images from gallery and text from EditText. We need to understand this; images are stored in SQLite database as BLOB data type. A BLOB is a large binary object that can hold a variable amount of data.  Note, we can only store images in the database as BLOB data type. We need to convert our image path to a bitmap then to bytes. Also