Versions Compared

Key

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

...

Info

Please note any attribute name need to be mentioned in double curly braces. eg : {{symbol}}

Registry Based 

1. Creating the plain text content file  in the registry with the name "quoteDataTemplate" in the "config" directory of registry, (You can create in the "governance" directory also)

Image Added

2. Then select the resource that you created in registry. First click on the Pick from registry option , then you can see options (Configuration Registry and Governance Registry) to select the registry resource 

Image Added

3. Then click on Configuration Registry link, since we have create the resource in config directory, select the specific resource as shown below and click on OK button. 

Image Added

3. After adding details click the Add Event Formatter button. The Available Event Formatter page will open. To view event formatter configurations, click on the event formatter name. To delete event formatter, click the Delete button.

Image Added

  

Editing Event Formatter Configuration through the Management Console

By Clicking the Edit button of the relevant event formatter, you will able to edit the event formatter configuration and redeploy it. When you click the Edit button, it will redirect to a xml based editor window which allow you to edit the event formatter configuration from UI without opening the configuration file in the file system.

Image Added

Configuring through a xml File

You can specify a event formatter configuration through in a xml file and deploy it in the deployment directory in the server. Event Formatter deployment directory is available at <CARBON_HOME>/repository/deployment/server/eventformatters . This is an hot deployment directory, then it is easy to deploy and undeploy an event formatter configuration.

1. Create a xml file and enter the following xml mapping event formatter configurations inside the above mentioned hot deployment directory. Event formatter implementation needs to be start with "eventformatter" root element.

Code Block
languagehtml/xml
<eventFormatter name="xmlEventFormatter" xmlns="http://wso2.org/carbon/eventformatter">
  <from streamName="stockStream" version="1.0.0"/>
  <mapping type="xml">
    <inline>
      <quotedata:StockQuoteDataEvent
        xmlns:quotedata="http://ws.cdyne.com/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <quotedata:StockSymbol>{{symbol}}</quotedata:StockSymbol>
        <quotedata:LastTradeAmount>{{price}}</quotedata:LastTradeAmount>
      </quotedata:StockQuoteDataEvent>
    </inline>
  </mapping>
  <to transportAdaptorName="localWsEventSender" transportAdaptorType="ws-event-local">
    <property name="topic">FastMovingStockQuotes</property>
  </to>
</eventFormatter>