WSO2 Complex Event Processor is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.
||
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 the specified event stream. Custom events are events with custom mappings  that does not adhere to the default event formats. For more information on event formats, see Event FormatsAlso, there are some of the Regular Expressions that are used to classify the text which 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 which 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 CEP 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  <CEP_HOME>/samples/cep/artifacts/0022/fileReceiver.csv  file, and append several lines in similar format as the first line which is already entered.

You can use a command similar to below to add the lines to the fileReceiver.csv. Please do not edit the file directly and save as this will not work when tailing the file.

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 and the input values mapped by the receiver are logged by the logger.

You view the CEP server receiving the events in the logs of it in the CLI as shown below.

  • No labels