Rai NAT (Normalization and Transformation Service)
The Rai Normalization and Transformation Service (Rai NAT) applies transform functions to Rai Cache data on the inbound side, outbound side, or both. Rai NAT can be configured either as a service in the Rai Cache or as a separate instance of the Rai Cache providing stand-alone transformation and data normalization services. Rai NAT uses an extremely flexible perl-like syntax and xml for constructing transform functions.
Rai NAT supports:
- regular expression matching for transform functions
- csv file listed transform functions
- transformation on either (or both) the inbound or outbound side
- field transformation
- multiple transformations
- xml-based transform configuration
Rai NAT allows a great deal of control over subject and data mapping on the network. A typical application of Rai NAT is data normalization to an in-house data standard or as a means of insulating applications from changes in upstream data definitions. Managing changes in Rai NAT eliminates the requirement to manage changes across application domains.
Sample Transformation
The following shows a transformation that matches all RV subscriptions, filters them by a transform function, and then applies an appropriate message transform on the matching subjects:
Stanza for the Rai Cache:
<protocol-rv>
<source subject=">"
subscriber-listen="%filter(>)"/>
</protocol-rv>
The transform that is placed in the transform.xml file:
<transform name="filter" >
<switch>
<case test="TSE\.REC\.([^.]+)\.([^.]+)">
<print val="TSE.INTERNAL.$1.$2"/>
<set msg-field-rename="tse-rename"
msg-format="TIB_SASS"
msg-form="EQ"/>
</case>
<case test="NASDAQ\.REC\.([^.]+)\.([^.]+)">
<print val="NASDAQ.INTERNAL.$1.$2"/>
<set msg-field-rename="nasdaq-rename"
msg-format="TIB_SASS"
msg-form="EQ"/>
</case>
</switch>
</transform>
The above function will use the tse-rename function or the nasdaq-rename function to map fields into an EQ TIB_SASS record. If any other subject is requested, it will be ignored by the subscriber-listen. The rename functions test the incoming field name and output an EQ field name. This example would map the internal Cache representation of the message to an external EQ SASS message which the client applications would see. The rename functions could be defined like this:
<transform name="tse-rename" >
<switch>
<case test="symbol"> <print val="SUBJ_SYMB"/> </case>
<case test="time"> <print val="FEED_TIME"/> </case>
<case test="name"> <print val="DISP_NAME"/> </case>
<case test="ask"> <print val="PRICE_ASK"/> </case>
<case test="bid"> <print val="PRICE_BID"/> </case>
<!-- ... etc ... -->
</switch>
</transform>
