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 receive custom messages with common CSV data standard and how to map the values for a specified event stream. 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. Also, there are some of the Regular Expressions that are used to classify the text that is logged by the logger publisher. This sample does not do any processing on the incoming event. The log event publisher is used to log the received events that are read from a CSV file using the file tail receiver.  

Common RegEx to clarify inputs and outputs in WSO2 CEP

  1. Receiving the CLI logging as events
    1. timestamp:  \[(.+)\]

    2. information type:     \]\s+(\w*)\s+
    3. class name:   \{(.+)\}
    4. information:  \ } \ s*- \ s*(.*)
  2. Receiving events from a standard CSV file (data is separated by a comma and events are separated by a new line character)
    1. first element:  ([^,]+)
    2. second element:   [^,]+,([^,]+)
    3. third element:  [^,]+,[^,]+,([^,]+)

Prerequisites

Set up the prerequisites required for all samples.

Building the sample 

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

This sample configuration creates the following.

  • A stream named org.wso2.event.sensor.stream:1.0.0.
  • An event receiver named fileTailerReceiv er.
  • An event publisher named fileLogger to log the messages.

Executing the sample

Navigate to the  <DAS_HOME>/samples/cep/artifacts/0022/fileReceiver.csv file, and append several lines in a format similar to the first line that is already entered.

You can use a command similar to the command given below to add the lines to the fileReceiver.csv. Do not edit the file directly and save because that does not allow the file to be successfully tailed.

echo '19900813115834,false,110,temperature,20.4435,5.43435,8.9,1.23434' >> fileReceiver.csv

The file tail receiver reads from the CSV file as it gets updated. The input values mapped by the receiver are logged by the logger.

The events received by the DAS server are logged in the CLI as shown below.

  • No labels