Choreography Projection and Contract Refinement Mario Bravetti Department of Computer Science http://cs.unibo.it/~bravetti University of Bologna INRIA research team FOCUS Joint work with: Ivan Lanese, Gianluigi Zavattaro
Plan of the Plan of the Talk � Global and Local Choreography � Contract+based service discovery � A dynamic update mechanism � Conclusion
Web Service Choreography Description Language � Describe the interaction among the combined services from a top abstract view Choreography Orchestration (e.g. WS-CDL) (e.g. WS-BPEL) Top abstract view One Party detailed of whole system: view of the system each action is a that orchestrates a communication part of it by sending involving two of (to other parties) & its participants receiving messages
Similar to UML Sequence Diagrams
WS+CDL � Global view of service interactions Seller Buyer Bank
WS+CDL � Global view of service interactions Seller Request Request Buyer Bank
WS+CDL � Global view of service interactions Seller Request Request Offer Buyer PayDescr Bank
WS+CDL � Global view of service interactions Seller Request Request Offer Buyer PayDescr Payment Bank
WS+CDL � Global view of service interactions Seller Request Request Offer Buyer PayDescr Confirm Payment Receipt Bank
WS+CDL Request Buyer � Seller ; ( Offer Seller � Buyer | PayDescr Seller � Bank ) ; PayDescr Seller � Bank ) ; Payment Buyer � Bank ; ( Confirm Bank � Seller | Receipt Bank � Buyer )
Projection of the Choreography on the Single Participants Buyer: Invoke(Request)@Seller;Receive(Offer); Invoke(Payment)@Bank;Receive(Receipt) Seller: Receive(Request); (Invoke(Offer)@Buyer | (Invoke(Offer)@Buyer | Invoke(PayDescr)@Bank); Receive(Confirm) Bank: Receive(PayDescr);Receive(Payment); (Invoke(Receipt)@Buyer | Invoke(Confirm)@Seller)
Well Formed WS+CDL specifications � Can we always project a WS+CDL specification in an equivalent one? � Which kind of equivalences are � Which kind of equivalences are preserved?
A Formal Model for WS+CDL � A global choreography language: H ::= a r � � s | 1 | 0 | � � H;H | H+H | H|H | H* H;H | H+H | H|H | H*
A Formal Model for WS+CDL � A global choreography language: H ::= a r � � s | 1 | 0 | � � H;H | H+H | H|H | H* H;H | H+H | H|H | H* r invokes the operation a of s Unsuccessful Successful termination termination
A Formal Model for WS+CDL � A global choreography language: H ::= a r � � s | 1 | 0 | � � H;H | H+H | H|H | H* H;H | H+H | H|H | H* Sequence Choice Parallel Repetition
A Formal Model for orchestrations � A language for orchestrations: P ::= a | a r | 1 | 0 | P;P | P+P | P|P | P* P;P | P+P | P|P | P* S ::= [P] r | S|S
A Formal Model for orchestrations � A language for orchestrations: P ::= a | a r | 1 | 0 | P;P | P+P | P|P | P* P;P | P+P | P|P | P* S ::= [P] r | S|S Unsuccessful receive on a termination Successful invoke a at r termination
A Formal Model for orchestrations � A language for orchestrations: P ::= a | a r | 1 | 0 | P;P | P+P | P|P | P* P;P | P+P | P|P | P* S ::= [P] r | S|S Sequence Choice Parallel Repetition
A Formal Model for orchestrations � A language for orchestrations: P ::= a | a r | 1 | 0 | P;P | P+P | P|P | P* P;P | P+P | P|P | P* S ::= [P] r | S|S Parallel composition Behaviour of of participants participant r
The “canonical” projection � Projection [[ H ]] t of choreography H to participant t a s if t=r [[ a [[ a r � � s ]] t ]] = = a a if t=s if t=s � � 1 otherwise [[H;H’]] t =[[H]] t ; [[H’]] t [[H|H’]] t =[[H]] t | [[H’]] t [[H+H’]] t =[[H]] t + [[H’]] t [[H*]] t =[[H]] t *
Example � Consider the global choreography: a r � � s ; b t � � � � � � u � Projection: � Projection: [ a s ;1] r | [ a;1 ] s | [ 1;b u ] t | [ 1;b ] u � Are the two choreographies equivalent? � NO � But, if r=t…. YES [ a s ; b u ] r | [ a;1 ] s | [ 1;b ] u
Asynchronous communication � Reconsider the example assuming asynchronous communication [ a s ; b u ] r | [ a ] s | [ b ] u [ a s ; b u ] r | [ a ] s | [ b ] u � Communication on a starts before communication on b but could finish after � What we should observe? � Send, Receive, both, …?
A lattice of possible observation criteria Synchronous Sender Sender Receiver Receiver Sender+receiver
A lattice of possible observation criteria Assuming synchronous communication: Synchronous observe either send or receive Sender Sender Receiver Receiver Sender+receiver
A lattice of possible observation criteria Synchronous Sender Sender Receiver Receiver Assuming asynchronous Sender+receiver communication: observe send
A lattice of possible observation criteria Synchronous Sender Sender Receiver Receiver Assuming asynchronous Sender+receiver communication: observe receive
A lattice of possible observation criteria Synchronous Sender Sender Receiver Receiver Assuming asynchronous Sender+receiver communication: observe send and observe receive
What about the previous example? � Reconsider the example a r � � s ; b r � � � � � u � [ a s ; b u ] r | [ a ] s | [ b ] u [ a s ; b u ] r | [ a ] s | [ b ] u � OK: for synchronous and sender � NO: for receiver, sender+receiver
Main results � For each observation criterion: � Sufficient conditions (connectedness, unique point of choice, and causality safe) that guarantee that a global choreography that guarantee that a global choreography is equivalent to the projected one
Unique point of choice � In a choice H+H’ � The sender of the initial transitions in H and in H’ is always the same � The roles in H and in H’ are the same � Example: if we drop the second condition (a r � � s + b r � � t ); c s � � t � � � � � � [ ( a s +b t );1] r | [ (a+1);c t ] s | [ (1+b);c ] t
Which equivalence between global and local choreographies? � Synchronous equivalence: global transitions are matched by synchronous local transitions � Sender equivalence: global transitions are matched by local sends, local receives are abstracted away by local sends, local receives are abstracted away � weak w.r.t. local receive transitions � Receiver equivalence: global transitions are matched by local receives, global sends are abstracted away � weak w.r.t. local send transitions � Sender+Receiver equivalence: both conditions above
Example: Receiver equivalence � Global choreography: a r � � s ; b t � � � � � � s � Local choreography: � Local choreography: [ a s ] r | [ a;b ] s | [ b s ] t � The two systems are receiver equivalent
Plan of the Plan of the Talk � Global and Local Choreography � Contract+based service discovery � A dynamic update mechanism � Conclusion
Contracts � Contract: service “behavioural interface” � correct sequences public registry of invoke and receive Contract: Contract: � as in an orchestration abstract service (role of a coreography) description � just finite+state labeled transition systems with successful termination Service
Contract Compliance � Verification of correctness of service composition based on their contracts: successful interaction i.e. no deadlock / termination reached public registry public registry Contract: Contract: … abstract service abstract service description description Reciprocal invocations … Service Service
Service Compliance: Formally � Services are compliant if the following holds for their composition P : τ τ P --->* P’ P --->* P’ implies that there exist P’’ and P’’’ s.t. τ √ P’ --->* P’’ ---> P’’’ � i.e. every computation can be extended to reach successful completion of all services � termination under fairness assumption
Example: compliant services � The following pairs of services are compliant: � C 1 = a+b+c C 1 = a+b+c C 2 = a + b C 2 = a + b � C 1 = a;b C 2 = a | b � C 1 = (a; b )* C 2 = a;( b;a )*;b
Compliance+Preserving Contract Refinement ! Choreography projection projection compliant by construction Contract Part. 1 Contract Part. n … refines refines compliance public registry public registry preserved by refinement … Contract Contract Reciprocal invocations … Service Service
Contract Refinement Relation Choreography compliant by construction Contract Part. 1 Contract Part. n … refines refines compliance public registry public registry preserved by refinement … Contract Contract Reciprocal invocations … Service Service
Formally: Subcontract Preorder � Preorder ≤ between contracts C : � C’ ≤ C means C’ is a subcontract of C C C subcontract preorder sub-contracts of C
Definition of Preorder Induced from Independent Refinement Given a set of compliant contracts … C 1 C 2 C n subcontract preorder preorder sub-contracts sub-contracts sub-contracts … of C n of C 1 of C 2 … C’ 1 C’ 2 C’ n is a set of compliant contracts
Recommend
More recommend