Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot...
-
Upload
collin-cook -
Category
Documents
-
view
215 -
download
0
Transcript of Π 4 Technologies Building distributed systems using WS-CDL and FpML 16th May 2007 Steve Ross-Talbot...
π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)
π4 Technologies
Agenda
• Background
• Why is process important?
• Why use WS-CDL?
• What is WS-CDL?
• Deep dive
π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
π4 Technologies
Background• Typical message:
π4 Technologies
Background• Typical flow:
π4 Technologies
The problem
• How do we know what the context is for any FpML message
Is it NovationConsentGranted?
Is it NovationConsentRefused?
π4 Technologies
The solution today
• Hope and pray ….– Add meta data around the FpML package– Agree meta data with your clients
NovationConsentGrantedAllocationId 9876
π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.
π4 Technologies
The problem today
• Sequence diagrams are not enough
π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
π4 Technologies
Buyer Seller
Shipper
CreditAgency
An Example - Bubble and Stick
π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
π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
π4 Technologies
An Example - Sequence diagrams
π4 Technologies
An Example - Sequence diagrams
π4 Technologies
An Example - Sequence diagrams
π4 Technologies
An Example - Sequence diagrams
π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.
π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.
π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.
π4 Technologies
Where does WS-CDL fit?
• XMLSchema describes format• WS-CDL described behavior
Format + Behavior = systems
π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
π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
π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
π4 Technologies
FpML 4.3 model designerPlacing an
Order
π4 Technologies
FpML 4.3 modelPlacing an
Order
π4 Technologies
FpML 4.3 modelExecuting the
Trade
Allocating the Trade
π4 Technologies
FpML 4.3 model Handling theContract
π4 Technologies
FpML 4.3 model Handling theContract
π4 Technologies
FpML 4.3 modelConfirming the
Contract
π4 Technologies
FpML 4.3 modelConfirming the
Contract
π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
π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}
π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 …..
π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
π4 Technologies
ConfirmAllocation
RequestAllocationConfirmationModifyAllocationConfirmationModifyAllocationMatchModifyAllocationConfirmationModifyAllocationMatchRequestAllocationMatchedAllocationMatchedAllocationConfirmed
FpML 4.3 confirmations
π4 Technologies
FpML 4.3 scenario
π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(….)
π4 Technologies
CDL generation
π4 Technologies
CDL generation
π4 Technologies
CDL generation
π4 Technologies
CDL generation
π4 Technologies
CDL generation
π4 Technologies
CDL generation<NameOfExchange>Receive
public class PublishMessageExReceive
extends DefaultActivityExtension
implements ReceiveActivityExtension{
…….
public void processMessage(ExtensionContext context,
Message message)
throws ServiceException
{
}
}
π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);
}
}
π4 Technologies
CDL generation<NameOfSilentAction>Activity
public class PrepareCounterPartyExceptionActivity extends DefaultActivityExtensionimplements SilentActivityExtension
{…….public void process(ExtensionContext context)
throws ServiceException {
……}
}
π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);
}}
π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);
}}
π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);
}}
π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
π4 Technologies
Demo
Accepter
Alledger
Confirming the Contract
π4 Technologies
Demo
π4 Technologies
Demo
π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.
π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)
π4 Technologies
Questions