Upload
wso2
View
2.502
Download
1
Tags:
Embed Size (px)
DESCRIPTION
Paul Fremantle (CTO), Asankha Perera (ESB Architect), Ruwan Linton (Senior Software Engineer)
Citation preview
Real world scenarios with the WSO2 ESBPaul Fremantle, CTOAsankha Perera, ESB ArchitectRuwan Linton, Senior Software Engineer
1st July 2008
ESB 1.7 Webinar Series
June 17th – Introducing WSO2 ESB 1.7 July 1st – Example Integration
Scenarios July 3rd – Introducing WSO2 ESB 1.7
(repeat) July 15th – Using WSO2 ESB with FIX July 29th – Complex Event Processing
Three real world scenarios in some detail 1. XML transformation and message
augmentationAsankha Perera – Lead Architect, WSO2
ESB 2. Financial services case – reading
legacy files and integrating with JMSPaul Fremantle, CTO
3. The PushMePullYou – using polling to integrate two servicesRuwan Linton, Senior Software Engineer
XML Transformation of messages with Database augmentation
This example illustrates how a database table lookup can be used to augment and transform the message payload, using XSLT transformations
Objective
Configure the external database access
Specify SQL and map parameters, and results
Transform using XSLT
Scenario – Financial Security blocking
Database
legacyflat file
NEW YORK
Existing System
WSO2 ESBPoll
Record->XMLXML->XML
Send
LONDON
WSO2 ESBSplit/Iterate
DBLookup/FilterTransform to MQ
Send
Existing System
XML/JMS
Overall ESB flow
FileSystemListener
NY Sequence
Log
Out-Only
Flatpack
E4X
Send to London
LondonEndpoint
LondonSequence
Iterate
DBReport – log whole msg
Filter/Drop NOAC
Send
Proxies
New York – File System Listener
New York Sequence
Flatpack Mediatorhttp://esbsite.org/resources.jsp?path=/mediators/paulfremantle/FlatPackMediator <class name="org.apache.synapse.mediators.contrib.FlatPackMediator"> <property name="ParserType" value="records_config"/> <property name="config"><PZMAP xmlns=""> <COLUMN name="INDICATOR" length="2"/> <RECORD id="D6" startPosition="1" endPosition="2" indicator="D6"> <COLUMN name="INDICATOR" length="2" /> <COLUMN name="ACTIONKEY" length="16" /> <COLUMN name="NA1" length="5" /> <COLUMN name="ACCNUM" length="15" /> <COLUMN name="ACTTYPE" length="6" /> <COLUMN name="SECID" length="12" /> <COLUMN name="SECIDTYPE" length="3" /> <COLUMN name="REGCODE" length="5" /> <COLUMN name="NA2" length="56" /> <COLUMN name="ONVF" length="3" /> <COLUMN name="NA3" length="244" /> <COLUMN name="UNITSEL" length="22" /></RECORD></PZMAP> </property></class>
Transforming using E4X
Scripting XML with E4X<script language="js"><![CDATA[ var rowset = mc.getPayloadXML() /* use the default namespace from the Flatpack mediator */ var ns = new Namespace("http://ws.apache.org/synapse/ns/rowset");
/* find all the D6 rows */ var d6 = rowset..ns::row.(@recordname=="D6"); /* create a holder element for the <FEED> elements */ var output = <FEEDS/>
for (var i=0; i<d6.length(); i++) { var row = d6[i]; /* lookup the important data */ var ActionKey = row.ns::entry.(@name=="ACTIONKEY").text(); var AccNum = row.ns::entry.(@name=="ACCNUM").text(); var ActType = row.ns::entry.(@name=="ACTTYPE").text(); var SecID = row.ns::entry.(@name=="SECID").text(); var SecIDType = row.ns::entry.(@name=="SECIDTYPE").text(); var ONVF = row.ns::entry.(@name=="ONVF").text(); var UnitsEl = row.ns::entry.(@name=="UNITSEL").text(); var RegCode = row.ns::entry.(@name=="REGCODE").text();
Scripting XML continued
var feed = <FEED> <ActionKey>{ActionKey}</ActionKey> <AccountNumber>{AccNum}</AccountNumber> <ActionType>{AccType}</ActionType> <SecurityID>{SecID}</SecurityID> <SecurityIDType>{SecIDType}</SecurityIDType> <ONVF>{ONVF}</ONVF> <UnitsElected>{UnitsEl}</UnitsElected> <RegCode>{RegCode}</RegCode> </FEED>; output.appendChild(feed); } mc.setPayloadXML(output); ]]> </script>
London - Iterate
Log the whole message
Final steps
PushMePullYou
Pull n Push scenario
Task Configurationspecify the taskimplementation
taskproperties
task scheduler configuration
Calling the data service
external data service endpoint
configuration
Calling Clearance Servicesplit the message into number of messages
transform the individual messages
clearance service
endpoint
Clearance Responsetransform the responses
from the clearance service
aggregate the responses from the clearance into one
response
Summary
Covered a set of useful casesChanging the flow of control Iteration and AggregationTwo ways of transforming XMLReading record formats Integrating with File-based systemsDBReport and DBLookup
Questions
Resources WSO2 Webinars
http://wso2.on.intercall.com WSO2 ESB documentation
http://wso2.org/project/esb/java/1.7/docs/docs_index.html
User [email protected]
Recent performance testinghttp://wso2.org/library/3740