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

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

WSO2 CEP allows you to map custom content from registry for the XML, JSON and Text mapping  types. Custom mapping is stored as a registry resource to be used by the publisher instead of being specified as inline input. WSO2 CEP caches this resource at runtime, and the cache is updated after every cache timeout specified in minutes. If caching is not required, specify the cache timeout as 0.

The following example illustrates how to carry out custom mapping using a registry resource.

  1. Save the following configuration as an XML file in a preferred location in your machine.

    <?xml version="1.0" encoding="UTF-8"?>
    <eventPublisher ... xmlns="http://wso2.org/carbon/eventpublisher">
      <from ... />
      <mapping customMapping="enable" type="text">
        <registry cacheTimeoutDuration="15">conf:/templates/en/message</registry>
      </mapping>
      <to ... />
    </eventPublisher>
  2. Log into the WSO2 CEP Management Console.
  3. Add the XML file you created 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 View.
    3. Click Add Collection. In the Name field, enter Template and click Add. This creates a new sub directory named Template in the /_system/config directory.
    4. 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
      MethodUpload content from file
      FileBrowse and select the XML file you saved in step 1.
      NameCustomOutputMapping
      Media Typeapplication/xml
  4. Create a new publisher as follows. For more information, see Configuring CEP to Create Alerts - Creating event publishers.

    FieldValue
    Event Publisher Namelogger
    Event SourceSelect an available event stream.
    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 sSelect 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.
     

    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.
  • No labels