Wso2 Scenarios Esb Webinar July 1st

30
Real world scenarios with the WSO2 ESB Paul Fremantle, CTO Asankha Perera, ESB Architect Ruwan Linton, Senior Software Engineer 1 st July 2008

description

Paul Fremantle (CTO), Asankha Perera (ESB Architect), Ruwan Linton (Senior Software Engineer)

Transcript of Wso2 Scenarios Esb Webinar July 1st

Page 1: Wso2 Scenarios Esb Webinar July 1st

Real world scenarios with the WSO2 ESBPaul Fremantle, CTOAsankha Perera, ESB ArchitectRuwan Linton, Senior Software Engineer

1st July 2008

Page 2: Wso2 Scenarios Esb Webinar July 1st

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

Page 3: Wso2 Scenarios Esb Webinar July 1st

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

Page 4: Wso2 Scenarios Esb Webinar July 1st

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

Page 5: Wso2 Scenarios Esb Webinar July 1st
Page 6: Wso2 Scenarios Esb Webinar July 1st

Configure the external database access

Specify SQL and map parameters, and results

Transform using XSLT

Page 7: Wso2 Scenarios Esb Webinar July 1st
Page 8: Wso2 Scenarios Esb Webinar July 1st
Page 9: Wso2 Scenarios Esb Webinar July 1st
Page 10: Wso2 Scenarios Esb Webinar July 1st

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

Page 11: Wso2 Scenarios Esb Webinar July 1st

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

Page 12: Wso2 Scenarios Esb Webinar July 1st

Proxies

Page 13: Wso2 Scenarios Esb Webinar July 1st

New York – File System Listener

Page 14: Wso2 Scenarios Esb Webinar July 1st

New York Sequence

Page 15: Wso2 Scenarios Esb Webinar July 1st

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>

Page 16: Wso2 Scenarios Esb Webinar July 1st

Transforming using E4X

Page 17: Wso2 Scenarios Esb Webinar July 1st

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();

Page 18: Wso2 Scenarios Esb Webinar July 1st

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>

Page 19: Wso2 Scenarios Esb Webinar July 1st

London - Iterate

Page 20: Wso2 Scenarios Esb Webinar July 1st

Log the whole message

Page 21: Wso2 Scenarios Esb Webinar July 1st

Final steps

Page 22: Wso2 Scenarios Esb Webinar July 1st

PushMePullYou

Page 23: Wso2 Scenarios Esb Webinar July 1st

Pull n Push scenario

Page 24: Wso2 Scenarios Esb Webinar July 1st

Task Configurationspecify the taskimplementation

taskproperties

task scheduler configuration

Page 25: Wso2 Scenarios Esb Webinar July 1st

Calling the data service

external data service endpoint

configuration

Page 26: Wso2 Scenarios Esb Webinar July 1st

Calling Clearance Servicesplit the message into number of messages

transform the individual messages

clearance service

endpoint

Page 27: Wso2 Scenarios Esb Webinar July 1st

Clearance Responsetransform the responses

from the clearance service

aggregate the responses from the clearance into one

response

Page 28: Wso2 Scenarios Esb Webinar July 1st

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

Page 29: Wso2 Scenarios Esb Webinar July 1st

Questions

Page 30: Wso2 Scenarios Esb Webinar July 1st

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