Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot...

56
π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography WG Chair Pi4 Technologies Foundation Thanks to Pi4 Technologies Foundation Ltd (www.pi4tech.com ) Hat Trick Software Ltd (www.hattricksoftware.com )

Transcript of Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot...

Page 1: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Building distributed systems using WS-CDL and FpML

16th May 2007Steve Ross-Talbot

CTO Hattrick Software

Chair W3C Web Services Choreography WG

Chair Pi4 Technologies Foundation

Thanks to

Pi4 Technologies Foundation Ltd (www.pi4tech.com)

Hat Trick Software Ltd (www.hattricksoftware.com)

Page 2: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Agenda

• Background

• Why is process important?

• Why use WS-CDL?

• What is WS-CDL?

• Deep dive

Page 3: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Background

• FpML– Financial Products Markup Language– Policed by ISDA

• FpML today is– A set of documents that describe the structure

of how to encode financial products in XML– XMLSchema to enable validation of correct

message formats– There are a set of sequence diagrams to govern

when to send what to whom

Page 4: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Background• Typical message:

Page 5: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Background• Typical flow:

Page 6: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

The problem

• How do we know what the context is for any FpML message

Is it NovationConsentGranted?

Is it NovationConsentRefused?

Page 7: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

The solution today

• Hope and pray ….– Add meta data around the FpML package– Agree meta data with your clients

NovationConsentGrantedAllocationId 9876

Page 8: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

The problem today

• Behavior first. Content second.

• No agreement on meta data needed, because there are no fully defined processes

• What makes a NovationConsentGranted a NovationConsentGranted is the process not the message. The message is a consequence.

Page 9: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

The problem today

• Sequence diagrams are not enough

Page 10: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

• Buyer, Seller, Credit Agency, Shipper.• Buyer barters with the Seller to get a price • Buyer accepts a price and places an order• Seller checks Buyers credit worthiness• Seller requests delivery from Shipper• Shipper sends delivery details to Seller and to Buyer

• How do we write this down today?– Bubble and stick– Sequence diagrams– WS-CDL

An Example

Page 11: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Buyer Seller

Shipper

CreditAgency

An Example - Bubble and Stick

Page 12: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Buyer Seller

• Buyer request a quote from the seller.

• Seller responds with a quote.

• Quotes may timeout.

• Buyer MAY update quote and request the update from the seller.

• Seller MAY respond with the update quote.

• Buyer MAY accept the quote.

An Example - Bubble and Stick

Page 13: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Buyer Seller

Shipper

CreditAgency

• Seller checks credit worthiness.

• Seller requests delivery from Shipper.• Shipper sends delivery details back to Seller and to Buyer.

• If Buyer accepts the quote.

• If Credit worthiness is okay

An Example - Bubble and Stick

Page 14: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

An Example - Sequence diagrams

Page 15: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

An Example - Sequence diagrams

Page 16: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

An Example - Sequence diagrams

Page 17: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

An Example - Sequence diagrams

Page 18: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Why Process?

• All messages exist in a context.– E.g. fpml:RequestAllocationConfirmation message will not be

relevant in an Affirmation (Trade) business process

• It’s not what you do but the way that you do it– Did I expect to get an fpml:AllocationConfirmed message after

sending an fpml:ConfirmAllocation?– Ordering is important because it defines how you behave.

Behaviour directly impact interoperability. Can I work with Mega Bank?

• Standardising the business processes increases STP rates and enables the market to grow.– The differentiator is the product being sold not how the back office

deal with it.

Page 19: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Why WS-CDL?

• Need to describe a business process from an architectural neutral perspective.

• Need to describe a complex model in which participant roles may change.

• Need to model a message oriented business processes as well as having an option to leverage Web Services.

• Need to use a recognised standard to avoid vendor lock-in.

• Need to have open source tools for description to avoid vendor lock-in.

Page 20: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

What is WS-CDL?

• Standard from the W3C

Enables processes (protocols, business processes) to be described from a neutral or global perspective, enabling the services to run as peers whilst guaranteeing interoperabilty of those services.

Described processes based on their common collaborative behavior through message passing, called interaction.

Page 21: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Where does WS-CDL fit?

• XMLSchema describes format• WS-CDL described behavior

Format + Behavior = systems

Page 22: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

FpML 4.3

• Open source tool for process description

• XMLSchema (with meta data identified)

• Scenarios validated against a WS-CDL model

• Scenarios for review, Html for review, BPMN for review

• Generation of roles directly into code or through UML into code

Page 23: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Opensource toolsuite

• Pi4 Technologies Foundation open source tool suite– www.pi4tech.org– Eclipse plugins (pi4tech update site)– Graphical modeling environment– Static type checking (completeness, lock free, race

condition free)– Export• WS-CDL• WSDL• HTML• BPMN

– Generate• UML artifacts• Java (for J2EE)• Java (for Axis)• BPEL

– Monitor• Against WS-CDL

description• Legacy and/or

generated

Page 24: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

FpML 4.3 model overview

Confirming the ContractConfirming the

Contract

Placing an Order

Executing the Trade

Allocating the Trade

Confirming the Contract

Handling theContract

Page 25: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

FpML 4.3 model designerPlacing an

Order

Page 26: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

FpML 4.3 modelPlacing an

Order

Page 27: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

FpML 4.3 modelExecuting the

Trade

Allocating the Trade

Page 28: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

FpML 4.3 model Handling theContract

Page 29: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

FpML 4.3 model Handling theContract

Page 30: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

FpML 4.3 modelConfirming the

Contract

Page 31: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

FpML 4.3 modelConfirming the

Contract

Page 32: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

FpML 4.3 model

• In a nutshell:– Types

• Roles - encapsulations of behavior• Participants - encapsulations of end-points that play roles• Information types - messages and useful variables• Channel types - to facilitate communication• Bindings of channel types to message types through identity

(called session typing)

– Ordering/Business Processes• Interactions over channels (sending and receiving of messages)• Ordering and dependencies

– Situated decisions @roles– Project out participant behaviors

Page 33: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

FpML 4.3 confirmationsAllocationAlleged [Acc2All] OR RequestAllocationConfirmation [All2Acc], AllocationUnmatched [Acc2All] ORRequestAllocationConfirmation [All2Acc], DO Loop

Loop {Choice {

1.ModifyAllocationConfirmation [All2Acc], IF (policy) THEN ModifyAllocationMatch[Acc2All]

2. AllocationMismatched[Acc2All]3. CancelAllocationConfimation[All2Acc], (AllocationCancelled OR AllocationAlreadyMatched)[Acc2All]4. AllocationAlreadySubmitted [Acc2All]5. RequestAllocationMatched[Acc2All], AllocationMatched[All2Acc], ConfirmAllocation[Acc2All], AllocationConfirmed[All2Acc]6. AllocationAlreadyMatched[Acc2All]

} if you do any of 2, 3,4 5,6 then break the loop}

Page 34: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

FpML 4.3 Confirmations

• Project out the behavior of the Alleger and the Accepter.

• AllStateMachine policies the Alleger role.– When it sends

• AccStateMachine policies the Accepter role.– This guy receives

• How do you know they are correct– Statically - advanced typechecking shows conformance.– At runtime - with session mgmt and monitoring against

expected behavior……. For example …..

Page 35: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

FpML 4.3 confirmationsAllocationAlleged

RequestAllocationConfirmation

AllocationUnmatched

RequestAllocationConfirmation

ModifyAllocationConfirmationModifyAllocationMatchModifyAllocationConfirmationModifyAllocationMatchModifyAllocationConfirmationModifyAllocationMatchCancelAllocationConfirmationAllocationCancelled

RequestAllocationConfirmationRequestAllocationMatchedAllocationMatchedConfirmAllocationAllocationConfirmed

RequestAllocationConfirmationModifyAllocationConfirmationModifyAllocationMatchModifyAllocationConfirmationModifyAllocationMatchRequestAllocationMatchedAllocationMatchedAllocationConfirmed

HOW CAN WE DETERMINE IF THESE SEQUENCES OF MESSAGES ARE CORRECT?

ConfirmAllocation

RequestAllocationConfirmationRequestAllocationMatchedAllocationMatchedConfirmAllocationAllocationConfirmed

RequestAllocationConfirmationModifyAllocationConfirmationModifyAllocationMatchModifyAllocationConfirmationModifyAllocationMatchRequestAllocationMatchedAllocationMatchedAllocationConfirmed

Page 36: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

ConfirmAllocation

RequestAllocationConfirmationModifyAllocationConfirmationModifyAllocationMatchModifyAllocationConfirmationModifyAllocationMatchRequestAllocationMatchedAllocationMatchedAllocationConfirmed

FpML 4.3 confirmations

Page 37: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

FpML 4.3 scenario

Page 38: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

CDL generation• CDL State machine per service

– Send• <NameOfExchange>Send.java

– Receive• <NameOfExchange>Receive.java

– SilentAction• <NameOfSilentAction>Activity.java

– Predicate• <NameOfPredicate>Predicate.java

– Channel (discovery)• <ChannelInstanceName>Channel.java

– Stubs• Preserve behavior of the distributed

system described Make calls to the context to retrieve, manipulate and store state.

• State is stored in a context per participant service and passed to the stubs

– Context• Hashmap (name, object)• Name is the name of the

variable in the CDL description

• setVariable(….)• getVariable(….)

Page 39: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

CDL generation

Page 40: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

CDL generation

Page 41: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

CDL generation

Page 42: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

CDL generation

Page 43: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

CDL generation

Page 44: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

CDL generation<NameOfExchange>Receive

public class PublishMessageExReceive

extends DefaultActivityExtension

implements ReceiveActivityExtension{

…….

public void processMessage(ExtensionContext context,

Message message)

throws ServiceException

{

}

}

Page 45: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

CDL generation<NameOfExchange>Send

public class InvalidCounterpartyExSend extends DefaultActivityExtensionimplements SendActivityExtension

{

…….public java.io.Serializable getMessageContent(

ExtensionContext context)throws UnresolvedConstraintException,

ServiceException {

java.io.Serializable ret=null;…….return(ret);

}

}

Page 46: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

CDL generation<NameOfSilentAction>Activity

public class PrepareCounterPartyExceptionActivity extends DefaultActivityExtensionimplements SilentActivityExtension

{…….public void process(ExtensionContext context)

throws ServiceException {

……}

}

Page 47: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

CDL generation<NameOfPredicate>Predicate

public class SuccessfulLookupPredicate extends DefaultActivityExtensionimplements PredicateExtension

{…….public boolean isSatisfied(ExtensionContext context)

throws UnresolvedConstraintException, ServiceException

{boolean ret=false;…….return(ret);

}}

Page 48: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

CDL generation<ChannelName>Channel

public class ConfirmationAlledgerChannel extends DefaultActivityExtensionimplements ChannelCreationExtension {

{…….public EndpointReference discover(

ExtensionContext context, String serviceType, String endpointReferenceType,ServiceRegistry registry, SemanticAnnotations semantics)

throws DeferProcessingException, ServiceException {EndpointReference ret=null;

ret = registry.discover(serviceType, endpointReferenceType);return(ret);

}}

Page 49: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

CDL generationContext:

Is a hash map.

Object val = context.getVariable(“businessEvent”);context.setVariable("businessEvent",val);

Contexts are local to the participant service

StubClass {

stubToFillIin(Context c){

v1 = c.getVariable(“varName”);……c.setVariable(“varName”,v1);

}}

Page 50: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Demo• CDL editor

– FpML model– End point projections– Generation to HTML and BPMN– Generation to Java

• Confirmations– Inject some messages– See what happens at the Acceptor and the Alledger– Monitor the participants against the choreography description

• Uses – generic CDL aware gateways and a monitor from Hat Trick Software, – Any JMS messaging, including QPid, – J2EE container

Page 51: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Demo

Accepter

Alledger

Confirming the Contract

Page 52: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Demo

Page 53: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Demo

Page 54: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Demo

Message contents: Could introduce an xslt style sheet to pretty print.

Logical communication channels between participants: NullChannel is for out of sequence messages.

What actually happened: Externally observable message exchanges.

Page 55: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Demo

Message Sequence Number for the monitorBusiness identifier for the transaction

Sending Participant (Service)

Receiving Participant (Service)

Logical operation nameStatus (Initiated means sender sent, Completed means receiver received)

Page 56: Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot CTO Hattrick Software Chair W3C Web Services Choreography.

π4 Technologies

Questions