WSO2 Complex Event Processor is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Log into the WSO2 CEP Management Console.
  2. Define an event stream as follows. For detailed instructions to create event streams, see Understanding Event Streams.

    1. Enter basic information for the stream as follows.

      ParameterValue
      Event Stream Namesensorsteam
      Event Stream Version1.0.0

      Add attributes as follows.

      Attribute CategoryAttribute NameAttribute Type
      Meta DatasensorIdint
       sensorNamestring
       languagestring
      Correlation Datalongitudedouble
       latitudedouble
      Payload DatasensorValuedouble
  3. Add an output mapping template as a registry resource as follows. For more information about the registry, see Registry.
    1. In the Main tab expand the Registry section and click Browse.
    2. Under Tree View, navigate to /_system/config directory and click Detail ViewClick Add Collection. In the Name field, enter Template and click Add. This creates a new sub directory named template in the /_system/config directory.
    3. Navigate to the /_system/config/template sub directory and click Add Resource. Then enter information as shown in the table below, and click Add.

      FieldValue
      MethodCreate Text Content
      Namemessage
      Media Type
      text/plain
      Content
      Welcome
      Sensor {{meta_sensorName}} reports {{sensorValue}} from {{correlation_longitude}}:{{correlation_latitude}}
  4. Create a new publisher as follows. For more information, see Configuring CEP to Create Alerts - Creating event publishers.

    FieldValue
    Event Publisher Namesamplelogger
    Event Sourcesensorstream
    Output Event Adapter Typelogger
  5. Under Mapping Configuration, select Text for the Message Format field. Then click Advanced. This expands the Create a New Event Publisher page to display the Text Mapping section. Select the Pick from Registry option. In the Registry Path field, navigate to the registry location where you saved the registry resource created in step 3.

    Info

    In this example, the default value of 15 is left unchanged for the Cache Timeout (in minutes) field. Therefore, this resource will be cached every 15 minutes.

  6. Click Add Event Publisher.
  7. In the Tools tab, click Event Simulator. In the Event Stream Name field, select sensorstream. Enter the following values for the parameters displayed, and then click Send to simulate a single event.

    ParameterValue
    sensorid10
    sensorNameTemperature
    languageen
    longitude79.861256
    latitude6.927131
    sensorValue23.0

     

    The output for this event is logged in the terminal as follows. 
     

Using custom registry paths

...