Download presentation
Presentation is loading. Please wait.
1
Calculi for Committed Choices and Compensations Roberto Bruni - Dipartimento di Informatica, Università di Pisa joint work with Gianluigi Ferrari Hernán Melgratti Ugo Montanari Daniele Strollo Emilio Tuosto Dip. Informatica, Univ. Pisa Santa Cruz (CA) USA, 18 January 2005
2
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations2 Motivations Design of business processes rigorous mathematical foundations clean semantics “expressiveness” well-disciplined service composition modular implementation Web Service Composition defining complex services as aggregations of simpler services
3
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations3 Motivations In long lasting negotiations partial agreements can be reached and locally committed by parties To be compensated in case of failure To be published / confirmed on success Formal models are needed To discover specification bugs To reason rigorously To run simulations To ease verification
4
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations4 Compensations To Compensate (Merriam-Webster OnLine) to neutralize the effect of to supply an equivalent to to provide with means of counteracting variation to offset an error, defect, or undesired effect The most important fact: Compensations have a cost
5
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations5 Compensations: Examples Late cancelling of hotel reservations can involve payment of fees Failures on credit checks can cause the abort of parallel activities (which can be partially completed) e.g. to unpackage the goods to be sent to cancel the courier booking Statements of politicians typically require an unbounded number of nested compensations
6
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations6 Approaches Flow Composition or Hierarchical Patterns Similar to workflow systems: a process describes the flow of both control and data among WS Interaction based Composition, Conversational Patterns or Global Model Services describe the ways they can be engaged in a larger process
7
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations7 Flow Composition A1A1 A2A2 A3A3 A4A4 A5A5
8
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations8 Transactional Flows A1A1 A2A2 A3A3 A4A4 A5A5
9
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations9 Compensation A1A1 B1B1 A2A2 B2B2 A3A3 B3B3 A4A4 B4B4 A5A5 B5B5
10
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations10 Compensation Flow A1A1 B1B1 A2A2 B2B2 A3A3 B3B3 A4A4 B4B4 A5A5 B5B5
11
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations11 Nested Flow Diagrams A1A1 B1B1 A2A2 B2B2 A3A3 B3B3 P P A4A4 B4B4
12
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations12 Interaction and Agreements In commercial applications, separately designed and implemented components must interact avoiding ad-hoc proprietary solutions offering alternatives to centralized transaction managers hiding the coordination layer (separation of concerns)
13
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations13 P1P1 P2P2 P3P3 {} Interacting Transactions {}
14
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations14 P1P1 P2P2 P3P3 {} Interacting Transactions {}
15
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations15 P1P1 P2P2 P3P3 {P 3 } {P 2 } Interacting Transactions {}
16
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations16 P1P1 P2P2 P3P3 {P 3 } {P 2 } Interacting Transactions {}
17
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations17 P1P1 P2P2 P3P3 {P 1,P 3 } {P 2 } Interacting Transactions {P 2 }
18
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations18 Outline of the talk Part I Transactional Flows with Compensations Part II A Process Calculus for Distributed Transactions Part III Prototype Implementations
19
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations19 Outline of the talk Part I Transactional Flows with Compensations Part II A Process Calculus for Distributed Transactions Part III Prototype Implementations
20
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations20 Part I - Flows Sequential Sagas Graphical representation Syntax Big Step Semantics Adequacy results Parallel Sagas Nested Sagas Additional features
21
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations21 Flow Diagrams and PDLs Many PDL proposals to describe business processes unambiguously XML-based WSFL, XLANG, BPEL4WS, … Extensions of known calculi committed Join (cJOIN), t-calculus, web -calculus Flow-based Structured Activity Compensation (StAC) now evolving to compensating CSP core flow language (FL) for sagas [BMM:POPL2005]
22
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations22 Sequential Sagas: Graphically Accept Order Refuse Order Update Credit Refund Money Prepare Order Update Stock
23
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations23 Sequential Sagas: Syntax Accept Order Refuse Order Update Credit Refund Money Prepare Order Update Stock (Step) X::=0 | A | A % B (Process)P::=X | P;P (Saga)S::={ P }
24
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations24 Sequential Sagas: Syntax Accept Order Refuse Order Update Credit Refund Money Prepare Order Update Stock S = { AO % RO ; UC % RM ; PO % US } (Step) X::=0 | A | A % B (Process)P::=X | P;P (Saga)S::={ P }
25
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations25 Sequential Sagas: Semantics An activity A either commits (A ) aborts (A ) = { A 1 ,…, A n }
26
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations26 Sequential Sagas: Semantics A saga S = { P } under either commits ( ) aborts ( ) fails ( ) is the observable flow S *
27
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations27 A process P under either commits ( ) aborts ( ) fails ( ) aborts = successfully compensated ß, ß’ are the installed compensations Sequential Sagas: Semantics *
28
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations28 Sequential Sagas: Semantics (saga) {P}
29
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations29 Sequential Sagas: Semantics 0 (zero) (saga) {P}
30
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations30 Sequential Sagas: Semantics 0 (zero) (saga) {P} A , A (s-act)
31
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations31 Sequential Sagas: Semantics A , A 0 (zero) (s-act) (s-cmp) (saga) A , (f-cmp) A , * {P}
32
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations32 Sequential Sagas: Semantics (s-step) ’’ ;’;’ (a-step’) (a-step’’) * *
33
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations33 Sequential Sagas: Adequacy S and = A 1 ;…;A n A1A1 AjAj AkAk AnAn
34
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations34 Sequential Sagas: Adequacy S and = A 1 ;…;A n S and = A 1 ;…;A k-1 ;B k-1 ;…;B 1 A1A1 AjAj AkAk AnAn A1A1 AjAj AkAk AnAn BjBj B1B1
35
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations35 Sequential Sagas: Adequacy S and = A 1 ;…;A n S and = A 1 ;…;A k-1 ;B k-1 ;…;B 1 S and = A 1 ;…;A k-1 ;B k-1 ;…;B j+1 A1A1 AjAj AkAk AnAn A1A1 AjAj AkAk AnAn BjBj B1B1 A1A1 AjAj AkAk AnAn BjBj B1B1 *
36
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations36 Parallel Sagas: Syntax Accept Order Refuse Order Update Credit Refund Money Prepare Order Update Stock
37
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations37 Parallel Sagas: Syntax (Step) X::=0 | A | A % B (Process)P::=X | P;P | P|P (Saga)S::={ P } Accept Order Refuse Order Update Credit Refund Money Prepare Order Update Stock
38
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations38 Parallel Sagas: Syntax S = { AO % RO ; UC % RM | PO % US } (Step) X::=0 | A | A % B (Process)P::=X | P;P | P|P (Saga)S::={ P } Accept Order Refuse Order Update Credit Refund Money Prepare Order Update Stock
39
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations39 Parallel Sagas: Naïvely B1B1 BjBj BnBn C1C1 CkCk CmCm A1A1 A2A2 B’ 1 B’ j A’ 1 C’ 1 C’ k C’ m A 1 ;(B 1 ;…;B j-1 ;B’ j-1 ;…;B’ 1 | C 1 ;…C m ;C’ m ;…;C’ 1 );A’ 1
40
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations40 Parallel Sagas: Revised A 1 ;(B 1 ;…;B j-1 ;B’ j-1 ;…;B’ 1 | 0);A’ 1 A 1 ;(B 1 ;…;B j-1 ;B’ j-1 ;…;B’ 1 | C 1 ;C’ 1 );A’ 1 … A 1 ;(B 1 ;…;B j-1 ;B’ j-1 ;…;B’ 1 | C 1 ;…C m ;C’ m ;…;C’ 1 );A’ 1 B1B1 BjBj BnBn C1C1 CkCk CmCm A1A1 A2A2 B’ 1 B’ j A’ 1 C’ 1 C’ k C’ m
41
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations41 A process P under either commits ( ) aborts ( ) fails ( ) is forced to abort ( ) is forced to fail ( ) is the observable concurrent flow Parallel Sagas: Semantics * *
42
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations42 Parallel Sagas: Semantics (saga) (forced-abt’) (forced-abt’’) * {,, } * {P}
43
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations43 Parallel Sagas: Semantics (s-par) ’’ |’|’
44
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations44 Parallel Sagas: Semantics ’’ | ’; (c-par’) 1, 2 {, } * * * * * * * ** **
45
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations45 Parallel Sagas: Semantics (c-par’’) * * * * * * * ** ** ’’ | ’; 1, 2 {, } *
46
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations46 Parallel Sagas: Semantics ’’ |’|’ (f-par) 1 {, } 2 {,,, } * * * * * * * * * * * ** **
47
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations47 Parallel Sagas: Adequacy Completion
48
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations48 Parallel Sagas: Adequacy Successful Compensation
49
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations49 Parallel Sagas: Adequacy Failed Compensation
50
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations50 Nested Sagas: Graphically Accept Order Refuse Order Update Credit Refund Money Prepare Order Update Stock Add Points Subtract Points
51
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations51 Nested Sagas: Syntax (Step) X::=0 | A | A % B | S (Process)P::=X | P;P | P|P (Saga)S::={ P }
52
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations52 Nested Sagas: Syntax S { AO % RO ; UC % RM | PO % US | {AP % SP} } Accept Order Refuse Order Update Credit Refund Money Prepare Order Update Stock Add Points Subtract Points
53
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations53 Nested Sagas: Semantics (sub-cmt) (sub-abt) (sub-fail) ß’ acts as default compensation * *
54
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations54 Nested Sagas: Semantics (sub-forced-1) (sub-forced-2’) * * (sub-forced-2’’) {, } * ;; * ;;
55
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations55 Nested Sagas: Adequacy Completion
56
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations56 Nested Sagas: Adequacy Successful Compensation
57
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations57 Failed Compensation Nested Sagas: Adequacy
58
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations58 More on Sagas Exception handling try S with P Used to catch crashes during backward computation Forward recovery strategies try S or P Can be used to retry or to improve activities Fully programmable compensations S % P More expressive than default compensation (sub-cmt) Allowed by languages like BPEL4WS Choices: Discriminator P Q Choices: Internal P Q Data dependencies A B Valid executions must satisfy dependency constraints
59
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations59 Outline of the talk Part I Transactional Flows with Compensations Part II A Process Calculus for Distributed Transactions Part III Prototype Implementations
60
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations60 Part II - cJoin Distributed Negotiations CHAM and JOIN cJOIN
61
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations61 Distributed Negotiations Negotiations / Contracts commit, abort, compensation hierarchical decisions dynamic membership fully distributed control Process cooperation coordination / orchestration / choreography different platforms and policies
62
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations62 Our Proposal: cJOIN committed JOIN Process Description Language presentation Non ACID (unrealistic in highly distributed systems) Multiway (several parties can start separately but commit on reached agreement) Programmable abort / non-perfect compensation Concurrency and distribution (Distributed 2PC) Different levels of abstraction (serializability)
63
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations63 Why JOIN? Well-known asynchronous calculus process calculus presentation few constructs, based on rendez-vous (atomic non- local interactions) basis for distributed programming language
64
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations64 Why JOIN? Extends a higher-order functional language parallelism in expressions (fork calls) parallelism in function patterns (join patterns) Distributed implementations JoCaml ( http://join.inria.fr ) http://join.inria.fr Polyphonic C#
65
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations65 Based on an elementary model of concurrency the reflexive chemical abstract machine = generic CHAM + imposing locality + adding reflection locality: only linear reaction patterns allowed each molecule or reaction rule is associated to a single reaction site reflection: reactions can generate new kinds of molecules together with their defining reaction rules Why JOIN?
66
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations66 Chemical Abstract Machine States are called solutions s Multisets of molecules m 1,…,m n data and rules (reflexive CHAM) Hierarchical structure via membranes Group solutions into molecules e.g. { s 1, { s 2 }, { s 3, { s 4 } } } multiset union Evolution (chemical rules) Heating / cooling (reversible) Structural equivalence Reactions Transitions Concurrency
67
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations67 JOIN Calculus in One Slide Syntax P,Q::=0 | x ŷ | def D in P | P|Q D,E::=J P | D E J,K::= x ŷ | J|K Operational semantics (CHAM Style) 0 P|Q P,Q D E D,E def D in P D dn(D), P dn(D) ( range dn(D) “globally fresh”) J P, J J P, P heating and cooling reaction processes definitions patterns resembles funct. prog. let f(x)=E in F (same scoping discipline)
68
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations68 Join calculus vs. calculus Join is essentially with restrictions on communication patterns Join combines restriction, reception and replication in a single receptor definition: they are not available separately Asynchrony forces us to create and send continuations in join Nevertheless, join and asynchronous have the same expressive power demonstrated by fully abstract encoding in each direction up to weak barbed congruence
69
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations69 Example: Cell Abstraction get k | s v k v | s v A cell s contains the value v To get the value: send a message on port get the parameter k is the return address, where the value v will be sent to
70
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations70 Example: Cell Abstraction get k | s v k v | s v A cell s contains the value v To set the value: send a message on port set the parameter m is the new value for s k is the return address (for confirmation) set m,k | s v k | s m
71
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations71 Example: Cell Abstraction get k | s v k v | s v The initial value in s is n But get, set and s are locally bound by def get and set must be extruded, otherwise no one can use them instead, s can be kept private set m,k | s v k | s m def in s n
72
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations72 Example: Cell Abstraction get k | s v k v | s v get, set are extruded on public channel c But c should be known only by the owner of the cell… set m,k | s v k | s m def in s n | c get,set
73
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations73 Example: Cell Abstraction get k | s v k v | s v A message to create triggers the outermost def: Three fresh names for s, get and set are allocated the initial value of s is the first parameter n get and set are sent back to the second argument c instead s will never be extruded Invariant in every configuration there is exactly one message on s set m,k | s v k | s m def in s n | c get,set def create n,c in …
74
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations74 Committed JOIN Syntax M,N::= 0 | x ŷ | M|N P,Q ::=M | def D in P | P|Q | abort | [P:Q] D,E ::=J P | D E | J P J,K ::= x ŷ | J|K messages programmable abort compensation contract boundaries merge definitions (boards): defined boards must be disjoint from ordinary defined names
75
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations75 Committed JOIN Semantics 0 P|Q P,Q DEDE D,E def D in P D dn(D), P dn(D) range( ) fresh J P, J J P, P
76
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations76 Committed JOIN Semantics 0 P|Q P,Q DEDE D,E def D in P D dn(D), P dn(D) range( ) fresh J P, J J P, P [P:Q] { P, Q } compensation is kept frozen contract P can evolve in isolation
77
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations77 Committed JOIN Semantics 0 P|Q P,Q DEDE D,E def D in P D dn(D), P dn(D) range( ) fresh J P, J J P, P [P:Q] { P, Q } { M|def D in 0, Q } M commit global resources
78
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations78 Committed JOIN Semantics 0 P|Q P,Q DEDE D,E def D in P D dn(D), P dn(D) range( ) fresh J P, J J P, P [P:Q] { P, Q } { M|def D in 0, Q } M { abort |P, Q } Q compensation on abort
79
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations79 Committed JOIN Semantics 0 P|Q P,Q DEDE D,E def D in P D dn(D), P dn(D) range( ) fresh J P, J J P, P [P:Q] { P, Q } { M|def D in 0, Q } M { abort |P, Q } Q J 1 |…|J n P, i { J i , S i, Q i } J 1 |…|J n P, {P , i S i, i Q i } merge n ongoing contracts
80
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations80 JOIN vs cJOIN PROPOSITION cJOIN is a conservative extension of JOIN: P J Q iff P cJ Q (for P and Q JOIN processes)
81
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations81 Hotel Booking H def WaitBooking [ def request o o $ | price $ price $ | confirm v BookedRoom v price $ abort in offeringRoom request,confirm : Q ] BookedRoom v … in WaitBooking | …
82
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations82 Hotel Booking H def WaitBooking [ def request o o $ | price $ price $ | confirm v BookedRoom v price $ abort in offeringRoom request,confirm : Q ] BookedRoom v … in WaitBooking | … C def BookingHotel [def hotelMsg r,c def offer $ c visa | HotelFound offer $ abort in r offer in searchRoom hotelMsg : Q’ ] in BookingHotel | …
83
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations83 Hotel Booking H def WaitBooking [ def request o o $ | price $ price $ | confirm v BookedRoom v price $ abort in offeringRoom request,confirm : Q ] BookedRoom v … in WaitBooking | … C def BookingHotel [def hotelMsg r,c def offer $ c visa | HotelFound offer $ abort in r offer in searchRoom hotelMsg : Q’ ] in BookingHotel | … HB def searchRoom hm | offeringRoom r,c hm r,c in H | C
84
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations84 Hotel Booking …, WaitBooking, BookingHotel …, […, offeringRoom request,confirm : Q ], […, searchRoom hotelMsg : Q’] …, […, hotelMsg request,confirm : Q | Q’] …, […, request offer : Q | Q’] …, […, offer $ , price $ : Q | Q’] …, […, confirm visa , HotelFound, price $ : Q | Q’] …, […, BookedRoom visa , HotelFound : Q | Q’] …, BookedRoom visa , HotelFound
85
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations85 Trip Booking I H as before F def WaitBooking [ def request o o $ | price $ price $ | confirm v BookedFlight v price $ abort in offeringFlight request,confirm : Q ] BookedFlight v … in WaitBooking | … local name, different from homonym name in H
86
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations86 Trip Booking II C def hotelOK fc | flightOK hc fc | hc BookingHotel [def hotelMsg r,c def offer $ c visa | hotelOK flightConf offer $ abort flightConf HotelFound in r offer in searchRoom hotelMsg : Q’ ] BookingFlight [def flightlMsg r,c def offer $ c visa | flightOK hotelConf offer $ abort hotelConf FlightFound in r offer in searchFlight flightMsg : Q’’ ] in BookingHotel | BookingFlight | … TB def searchRoom hm | offeringRoom r,c hm r,c searchFlight fm | offeringFlight r,c fm r,c in H | F | C both needed to commit
87
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations87 Something About cJOIN A simple type system guarantees serializability for Shallow processes Proof via correspondence w.r.t. big step semantics Commit primitives of cJOIN can be used to implement committed choices of AKL explicit encoding of search strategies and unification via continuation passing and compensation Zero-safe nets can also be straightforwardly encoded as cJOIN processes
88
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations88 Outline of the talk Part I Transactional Flows with Compensations Part II A Process Calculus for Distributed Transactions Part III Prototype Implementations
89
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations89 Java Transactional Web Services (JTWS) Java Signal Core Layer (JSCL) Java Transactional Layer (JTL) cJOIN compiler D2PC Part III - Implementation
90
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations90 JTWS Methodology GOAL: Automatic generation of the “coordination code” from a description of a composed WS design as well-formed flow diagrams or as processes in a suitable language automatic generation of coordination wrappers for invoking involved services in a sound way for managing commitments and compensations
91
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations91 JTWS and JSCL JTWS tailored to long running transactions JTWS is based on signal exchanges, publish/subscribe, event notification JSCL gives a minimal set of functionalities for creation/dismissal of new signal types signal emitters / handlers as services describing connections between components asynchronous / synchronous typed, peer-to-peer, unidirectional broadcast and bidirectional just requires additional links management of flow sessions
92
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations92 JTL Specialized kind of JTWS component API for (paradigms of) connectors only a minimal subset of signals is considered three signals can encode compensable transactions onInvoke onRollBack onCommit
93
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations93 JTL Component Wrappers WS iRb In iCt Out oRb oCt
94
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations94 JTL Transactional Component WS1 iRb In iCt Out oRb oCt WS2 WS1 % WS2 links are dynamically established depending on the internal state
95
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations95 JTL Sequence InOut iRb iCt oRb oCt JTL1 ; JTL2
96
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations96 JTL Transactional Sequence InOut offer the method addInternalComponent { JTL1 ; JTL2 }
97
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations97 JTL Trans. Parallel Component InOut offer the method addInternalComponent { JTL1 | JTL2 }
98
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations98 Encoding of cJOIN in JOIN Aim: Define an implementation of cJOIN in JOIN Associate to every cJOIN process a JOIN process that simulate its behavior Ideas: Identification of basic forms for definitions Definition of a type system to single out canonical processes Reuse controllers of the D2PC protocol
99
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations99 Distributed 2PC (D2PC) The Distributed 2PC is a variant of the decentralized 2PC When a participant P is ready to commit it has only a partial knowledge of the whole set of participants Only those who directly cooperated with P To commit P must contact all its neighbors and learn the identity of other participants from them The D2PC can be conveniently written in Jocaml
100
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations100 D2PC Every participant P acts as coordinator During the transaction P builds its own synchronization set L P of cooperating agents When P is ready to commit, P asks readiness to processes in L P (if empty P was isolated and can commit) In doing so, P sends them the set L P Other participants will send to P either a successful reply with their own synchronization sets or a failure message (in this case, failure is then propagated) Successful replies are added to L P The protocol terminates when L P is transitively closed
101
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations101 P1P1 P2P2 P3P3 Example: D2PC
102
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations102 P1P1 P2P2 P3P3 {} Example: D2PC
103
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations103 P1P1 P2P2 P3P3 {} Example: D2PC
104
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations104 P1P1 P2P2 P3P3 {} Example: D2PC {}
105
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations105 P1P1 P2P2 P3P3 {} Example: D2PC {}
106
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations106 P1P1 P2P2 P3P3 {P 3 } {P 2 } Example: D2PC {}
107
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations107 P1P1 P2P2 P3P3 {P 3 } {P 2 } Example: D2PC {}
108
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations108 P1P1 P2P2 P3P3 {P 1,P 3 } {P 2 } Example: D2PC {P 2 }
109
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations109 P1P1 P2P2 P3P3 {P 1,P 3 } {P 2 } Example: D2PC {P 2 }
110
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations110 P1P1 P2P2 P3P3 {P 1,P 3 } {P 2 } [P 2 ] () Example: D2PC {P 2 }
111
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations111 P1P1 P2P2 P3P3 {P 1,P 3 } {P 2 } [P 2 ] () Example: D2PC {P 2 }
112
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations112 P1P1 P2P2 P3P3 {P 1,P 3 } [P 1,P 3 ] () {P 2 } [P 2 ] () Example: D2PC {P 2 }
113
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations113 P1P1 P2P2 P3P3 {P 2 } [P 2 ] () {P 1,P 3 } [P 1,P 3 ] () Example: D2PC {P 2 }
114
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations114 P1P1 P2P2 P3P3 {P 2 } [P 2 ] () {P 1,P 3 } [P 1,P 3 ] (P 3 ) Example: D2PC {P 2 }
115
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations115 P1P1 P2P2 P3P3 {P 1,P 2 } [P 2 ] (P 2 ) {P 1,P 3 } [P 1,P 3 ] (P 3 ) Example: D2PC {P 2 }
116
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations116 P1P1 P2P2 P3P3 {P 1,P 2 } [P 1,P 2 ] (P 2 ) {P 1,P 3 } [P 1,P 3 ] (P 3 ) Example: D2PC {P 2 }
117
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations117 P1P1 P2P2 P3P3 {P 1,P 2 } [P 1,P 2 ] (P 2 ) {P 1,P 3 } [P 1,P 3 ] (P 3 ) Example: D2PC {P 2 }
118
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations118 P1P1 P2P2 P3P3 {P 2 } [P 2 ] () {P 1,P 2 } [P 1,P 2 ] (P 2 ) {P 1,P 3 } [P 1,P 3 ] (P 3 ) Example: D2PC
119
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations119 P1P1 P2P2 P3P3 {P 2 } [P 2 ] () {P 1,P 2 } [P 1,P 2 ] (P 2 ) {P 1,P 3 } [P 1,P 3 ] (P 3 ) Example: D2PC
120
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations120 P1P1 P2P2 P3P3 {P 2 } [P 2 ] () {P 1,P 2 } [P 1,P 2 ] (P 2 ) {P 1,P 3 } [P 1,P 3 ] (P 1,P 3 ) Example: D2PC
121
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations121 P1P1 Q2Q2 P3P3 {P 2 } [P 2 ] () {P 1,P 2 } [P 1,P 2 ] (P 2 ) {P 1,P 3 } [P 1,P 3 ] (P 1,P 3 ) Example: D2PC
122
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations122 P1P1 Q2Q2 P3P3 {P 2,P 3 } [P 2 ] (P 2 ) {P 1,P 2 } [P 1,P 2 ] (P 2 ) {P 1,P 3 } [P 1,P 3 ] (P 1,P 3 ) Example: D2PC
123
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations123 P1P1 Q2Q2 P3P3 {P 2,P 3 } [P 2 ] (P 2 ) {P 1,P 2 } [P 1,P 2 ] (P 2 ) {P 1,P 3 } [P 1,P 3 ] (P 1,P 3 ) Example: D2PC
124
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations124 P1P1 Q2Q2 P3P3 {P 2,P 3 } [P 2 ] (P 2 ) {P 1,P 2 } [P 1,P 2 ] (P 2 ) {P 1,P 3 } [P 1,P 3 ] (P 1,P 3 ) Example: D2PC
125
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations125 P1P1 Q2Q2 P3P3 {P 2,P 3 } [P 2,P 3 ] (P 2,P 3 ) {P 1,P 2 } [P 1,P 2 ] (P 2 ) {P 1,P 3 } [P 1,P 3 ] (P 1,P 3 ) Example: D2PC
126
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations126 P1P1 Q2Q2 P3P3 {P 2,P 3 } [P 2,P 3 ] (P 2,P 3 ) {P 1,P 2 } [P 1,P 2 ] (P 1,P 2 ) {P 1,P 3 } [P 1,P 3 ] (P 1,P 3 ) Example: D2PC
127
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations127 Q1Q1 Q2Q2 Q3Q3 {P 2,P 3 } [P 2,P 3 ] (P 2,P 3 ) {P 1,P 2 } [P 1,P 2 ] (P 1,P 2 ) {P 1,P 3 } [P 1,P 3 ] (P 1,P 3 ) Example: D2PC
128
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations128 Final Remarks I Our definition for compensable flow languages abstracts away from low-level computations can be easily extended independent from the coordination mechanisms that implement the primitives Java Transactional Web Services (JTWS) Distributed implementation of flows Allows to reason about program properties Adequacy Correctness of implementation
129
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations129 Final Remarks II cJOIN models multi-way transactions by describing interacting agents but not their global structure Shallow cJOIN is serializable cJOIN primitives are implementable in a distributed way at least the subcalculus of flat processes D2PC protocol is used
130
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations130 Some Pointers R. Bruni, C. Laneve, U. Montanari CONCUR 2002 (D2PC) R. Bruni, H. Melgratti, U. Montanari POPL 2005 (Flows) IFIP TCS 2004 + COMETA 2003 (cJOIN) Hernán Melgratti PhD Thesis submitted (Flows, cJOIN and more) Daniele Strollo Master Thesis in preparation (JTWS)
131
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Calculi for Committed Choices and Compensations131 JOIN: An Example A process P P z x,z | def x y z y,x in x v P as a solution { z x,z , w y z y,w , w v } A reaction { z x,z , w y z y,w , w v } { z x,z , w y z y,w , z v,w } bound name extrusion defined name received name free name -conversion
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.