Versions Compared

Key

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

This will convert Map Event Builder converts the events/streams from an Input Adaptor input event adapter that supports Map input streams into an event stream that is compatible with the Event Processor event processor. The event attributes will be are extracted using XPath expressions and converted to the type specified in the mapping before being sent to the Event Processorevent processor.

 

Configuring through the Management Console UI

1. Log in to the CEP management console and select the Main menu in the left hand side of the screen. Then select the Add menu item under Event Builder menu.

Image Removed

2. The Create a New Event Builder window opens, using which you can configure new event builders. Enter the following details in the form to create an Map based event builder as shown in the screenshot below.

Info
titleSupported Mapping Types

The selected transport adaptor must support Map mapping type and 'map' must be selected from the Input Mapping Type drop down for the proper input fields to appear.

Image Removed

 

The user interface is divided in to 3 main components (From, Mapping and To) and all properties come under a specific section (except the event builder name).

...

  • Destination - This will be the topic to which event publishers will publish

...

You can configure through the management console as explained below or by manually adding an XML file as explained in step 5.

  1. Start the CEP, log in to its management console, select Event Builders and click Add Event Builder.
  2. Enter details in the form that appears and click the Add Event Builder button at the end of the form. For example,
    Image Added
    The fields in the above configuration are as follows:

    • Event Builder Name : Property to uniquely identify an event formatter configuration
    • Input Event Adapter (marked as 1 in the screenshot) : The input event adapter used to publish events to the CEP. This drop-down list only displays the adapters that are already created. In this example, we select an Input JMS Event Adapter already created.
    • Input Event Adapter properties (marked as 2 in the screenshot) : Properties required by the input event adapter depending on the input event adapter type selected before. For example, if you select  an event adapter that supports Map, then the required properties are:
      • Destination - The topic to which event publishers send the events
    • Input Mapping Type (marked as 3 in the screenshot): Select map as the mapping type. This property changes based on the event adapter selected. It lists only the mapping types supported by a particular event adapter.
    • Mapping properties (marked as 4 in the screenshot) : Map the incoming stream to the outgoing stream received by the event processor. Provide the necessary details in the input fields:
      • Enter the  Input Attribute Name , Mapped To  and  To Stream Data Type  under

...

      • Properties

...

      • Click Add to add the individual attribute mapping to the event builder

...

      • Info

        For the correct properties to show, you must selected an event adapter that supports Map mapping type.

    • To Stream Name/Version : Stream name/version of the outgoing stream
3. After adding the relevant details click the Add Event Builder button. The Available Event Builders page will open. To view event builder configurations, click on the event builder name. To delete an event builder, click the Delete button.

Image Removed

...

  1. After a builder is successfully created, you can change its configuration and redeploy it. To do this, click the Edit link associated with it. You can also click the other links associated with it to delete or enable statistics and tracing.
  2. An XML based editor opens allowing you to edit the event builder configuration from the UI itself, without

...

  1. having to edit the

...

  1. file in the file system. Do your modifications and click Update.
  2. Alternatively,

    Image Removed

    Click Update after editing the configuration to save the changes and redeploy.

    Configuring through an XML File

    ...

    Anchor
    step5
    step5
    you can specify an event builder configuration using an XML file and save it in <PRODUCT_HOME>/repository/deployment/server/eventbuilders

...

  1. directory,

...

  1. which is the event builder

...

  1. deployment directory. Since hot deployment is enabled, you can simply add/remove files to deploy/undeploy from the server.

    Create the XML file with the following Map based event builder configurations

...

  1. . Event builder implementation

...

  1. must start with

...

  1. <eventbuilder> root element and

...

  1. the namespace

...

  1. set

...

  1. to http://wso2.org/carbon/eventbuilder  as in the example below

...

  1. :

    Code Block
    languagehtml/xml

...

  1. <eventBuilder name="mapbuilder" xmlns="http://wso2.org/carbon/eventbuilder">
      <from 

...

  1. eventAdaptorName="jmsActiveMqAdaptor" 

...

  1. eventAdaptorType="jms">
        <property name="transport.jms.Destination">PurchasesUK</property>
      </from>
      <mapping type="map" >
        <property>
          <from name="cardNo" />
          <to name="cardNo" type="string" />
        </property>
        <property>
          <from name="price" />
          <to name="price" type="float" />
        </property>
      </mapping>
      <to streamName="purchases" version="1.0.0" />
    </eventBuilder>