Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML...

29
Real world scenarios with the WSO2 ESB

Transcript of Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML...

Page 1: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

Real world scenarios with the WSO2 ESB

Page 2: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

Three real world scenarios in some detail 1. XML transformation and message

augmentation 2. Financial services case – reading

legacy files and integrating with JMS 3. The PushMePullYou – using polling

to integrate two services

Page 3: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

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 4: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.
Page 5: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

Configure the external database access

Specify SQL and map parameters, and results

Transform using XSLT

Page 6: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.
Page 7: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.
Page 8: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.
Page 9: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

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 10: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

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 11: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

Proxies

Page 12: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

New York – File System Listener

Page 13: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

New York Sequence

Page 14: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

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 15: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

Transforming using E4X

Page 16: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

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 17: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

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 18: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

London - Iterate

Page 19: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

Log the whole message

Page 20: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

Final steps

Page 21: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

PushMePullYou

Page 22: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

Pull n Push scenario

Page 23: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

Task Configurationspecify the taskimplementation

taskproperties

task scheduler configuration

Page 24: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

Calling the data service

external data service endpoint

configuration

Page 25: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

Calling Clearance Servicesplit the message into number of messages

transform the individual messages

clearance service

endpoint

Page 26: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

Clearance Responsetransform the responses

from the clearance service

aggregate the responses from the clearance into one

response

Page 27: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

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 28: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

Questions

Page 29: Real world scenarios with the WSO2 ESB. Three real world scenarios in some detail 1. XML transformation and message augmentation 2. Financial services.

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