Download presentation
Presentation is loading. Please wait.
1
1 Formal Languages for Flow Composition and Compensation: Sagas Roberto Bruni Dipartimento di Informatica Università di Pisa Models and Languages for Coordination and Orchestration IMT- Institutions Markets Technologies - Alti Studi Lucca
2
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 2 Models and Languages for Coordination and Orchestration cCSP and Sagas Independently from cCSP a similar calculus has been devised in Pisa inspired by sagas (rather than BPEL4WS) different compensation policies for parallel processes any action can succeed or fail THROW and YIELD are not explicit in the language big-step SOS semantics
3
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 3 Models and Languages for Coordination and Orchestration Outline Sequential Sagas Graphical representation Syntax Big Step Semantics Adequacy results Parallel Sagas Nested Sagas Additional features Comparison with cCSP Implementation issues
4
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 4 Models and Languages for Coordination and Orchestration 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 }
5
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 5 Models and Languages for Coordination and Orchestration Sequential Sagas: Semantics Preliminaries I Syntactic sugar inert compensations are immaterial A A % 0 sequential composition is associative ( P;Q ) ; R P ; ( Q;R ) 0 is the identity for sequential composition 0;P P;0 P
6
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 6 Models and Languages for Coordination and Orchestration Sequential Sagas: Semantics Preliminaries II An activity A either commits (A ) aborts (A ) = { A 1 ,…, A n }
7
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 7 Models and Languages for Coordination and Orchestration Sequential Sagas: Semantics Preliminaries III A saga S = { P } under either commits ( ) aborts ( ) fails ( ) is the observable flow S *
8
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 8 Models and Languages for Coordination and Orchestration A process P under either commits ( ) aborts ( ) fails ( ) aborts = successfully compensated ß, ß’ are the installed compensations Sequential Sagas: Semantics *
9
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 9 Models and Languages for Coordination and Orchestration Sequential Sagas: Semantics (f-cmp) A , * (saga) {P} 0 (zero) A , A (s-act) (s-cmp) A ,
10
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 10 Models and Languages for Coordination and Orchestration Sequential Sagas: Semantics (a-step’) (a-step’’) * * (s-step) ’’ ;’;’
11
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 11 Models and Languages for Coordination and Orchestration Sequential Sagas: Adequacy S and = A 1 ;…;A n A1A1 AjAj AkAk AnAn S and = A 1 ;…;A k-1 ;B k-1 ;…;B 1 A1A1 AjAj AkAk AnAn BjBj B1B1 S and = A 1 ;…;A k-1 ;B k-1 ;…;B j+1 A1A1 AjAj AkAk AnAn BjBj B1B1 *
12
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 12 Models and Languages for Coordination and Orchestration 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
13
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 13 Models and Languages for Coordination and Orchestration 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
14
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 14 Models and Languages for Coordination and Orchestration 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
15
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 15 Models and Languages for Coordination and Orchestration Digression: Parallel Sagas in cCSP A 1 ; B 1 ;…;B j-1 ;B’ j-1 ;…;B’ 1 ;A’ 1 A 1 ; ((B 1 ;…;B j-1 )|C 1 ) ; ((B’ j-1 ;…;B’ 1 )|C’ 1 ) ;A’ 1 … A 1 ; ((B 1 ;…;B j-1 )|(C 1 ;…;C m )) ; ((B’ j-1 ;…;B’ 1 )|(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
16
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 16 Models and Languages for Coordination and Orchestration Sequential Sagas: Semantics Preliminaries I Syntactic sugar parallel composition is AC1 A A % 0 ( P;Q ) ; R P ; ( Q;R ) 0;P P;0 P ( P|Q ) | R P | ( Q|R ) P | 0 P P | Q Q | P
17
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 17 Models and Languages for Coordination and Orchestration A process P under either commits ( ) aborts ( ) fails ( ) is forced to abort ( ) is forced to fail ( ) is the observable concurrent flow Parallel Sagas: Semantics Preliminaries II * *
18
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 18 Models and Languages for Coordination and Orchestration Parallel Sagas: SemanticsI (saga) (forced-abt’) (forced-abt’’) * {,, } * {P}
19
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 19 Models and Languages for Coordination and Orchestration Parallel Sagas: SemanticsII (s-par) ’’ |’|’
20
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 20 Models and Languages for Coordination and Orchestration Parallel Sagas: SemanticsIII ’’ | ’; (c-par’) 1, 2 {, } * * * * * * * ** **
21
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 21 Models and Languages for Coordination and Orchestration Parallel Sagas: SemanticsIV (c-par’’) * * * * * * * ** ** ’’ | ’; 1, 2 {, } *
22
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 22 Models and Languages for Coordination and Orchestration Parallel Sagas: SemanticsV ’’ |’|’ (f-par) 1 {, } 2 {,,, } * * * * * * * * * * * ** **
23
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 23 Models and Languages for Coordination and Orchestration Parallel Sagas: AdequacyI Completion
24
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 24 Models and Languages for Coordination and Orchestration Parallel Sagas: Adequacy II Successful Compensation
25
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 25 Models and Languages for Coordination and Orchestration Parallel Sagas: Adequacy III Failed Compensation
26
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 26 Models and Languages for Coordination and Orchestration Nested Sagas: Graphically Accept Order Refuse Order Update Credit Refund Money Prepare Order Update Stock Add Points Subtract Points
27
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 27 Models and Languages for Coordination and Orchestration Nested Sagas: Syntax (Step) X::=0 | A | A % B | S (Process)P::=X | P;P | P|P (Saga)S::={ P }
28
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 28 Models and Languages for Coordination and Orchestration 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
29
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 29 Models and Languages for Coordination and Orchestration Nested Sagas: SemanticsI (sub-cmt) (sub-abt) (sub-fail) ß’ acts as default compensation * *
30
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 30 Models and Languages for Coordination and Orchestration Nested Sagas: SemanticsII (sub-forced-1) (sub-forced-2’) * * (sub-forced-2’’) {, } * ;; * ;;
31
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 31 Models and Languages for Coordination and Orchestration Nested Sagas: Adequacy I Completion
32
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 32 Models and Languages for Coordination and Orchestration Nested Sagas: AdequacyII Successful Compensation
33
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 33 Models and Languages for Coordination and Orchestration Failed Compensation Nested Sagas: AdequacyIII
34
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 34 Models and Languages for Coordination and Orchestration Additional Features 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 P is tried when S aborts and is successfully compensated Fully programmable compensations S % P More expressive than default compensation (sub-cmt) Choices: Discriminator P Q Choices: Internal P Q Data dependencies A B Valid executions must satisfy dependency constraints
35
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 35 Models and Languages for Coordination and Orchestration Sagas vs cCSP I Executions of activities always successful in cCSP dependent on the context in Sagas Failures raised by primitive THROW in cCSP raised by activities that fail in in Sagas Yielding to interrupt both explicit and implicit in cCSP only implicit in Sagas
36
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 36 Models and Languages for Coordination and Orchestration Sagas vs cCSP II Abnormal termination successful compensation and abnormal termination of a transaction block are silent to parent processes in cCSP but not in Sagas where e.g. try S or P can be introduced Adequacy results via self-cancelling in cCSP simple and intuitive but imprecise via complex adequacy theorems in Sagas more precise but less intuitive, can give more insights
37
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 37 Models and Languages for Coordination and Orchestration Sagas vs cCSP III Trace models interleaving in cCSP (centralized) concurrent in Sagas (more distributed) Compensation policy of parallel processes coordinated interruption in cCSP no interruption but distributed compensation in Sagas naive distributed interruption in Sagas revised
38
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 38 Models and Languages for Coordination and Orchestration More on Compensation Policies for Parallel Processes The difference can be nicely illustrated in terms of semantic equivalence [ A % A° | B % B° | THROWW ] = traces 1. (A|B) ; (A°|B°) 2. (A;A°) | (B;B°) 3. SKIP + (A;A°) + (B;B°) + (A|B);(A°|B°) 4. SKIP + (A;A°) + (B;B°) + (A;A°)|(B;B°) cCSP revised Sagas naive Sagas 12 34
39
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 39 Models and Languages for Coordination and Orchestration Implementation 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
40
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 40 Models and Languages for Coordination and Orchestration Java Transactional Web Services (JTWS) Java Signal Core Layer (JSCL) Java Transactional Layer (JTL) JTWS Approach
41
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 41 Models and Languages for Coordination and Orchestration 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
42
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 42 Models and Languages for Coordination and Orchestration 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
43
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 43 Models and Languages for Coordination and Orchestration JTL Transactional Component WS1 iRb In iCt Out oRb oCt WS2 WS1 % WS2 links are dynamically established depending on the internal state
44
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 44 Models and Languages for Coordination and Orchestration JTL Sequence InOut iRb iCt oRb oCt JTL1 ; JTL2
45
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 45 Models and Languages for Coordination and Orchestration Some Concluding Remarks cCSP and Sagas abstract away from low-level computations can be easily extended independent from the coordination mechanisms that implement the primitives Allow to reason about program properties adequacy process equivalence correctness of implementation
46
Roberto Bruni @ IMT Lucca 12 April 2005 Institutions Markets Technologies IMT 46 Models and Languages for Coordination and Orchestration References A trace semantics for long-running transactions (Proc. 25 Years of CSP) M. Butler, C. Ferreira, T. Hoare Theoretical foundations for compensations in flow composition languages (Proc. POPL'05) R. Bruni, H. Melgratti, U. Montanari Models and languages for global computing transactions (PhD Thesis, Univ. of Pisa, 2005) H. Melgratti Composizionalità di transazioni e Web Services nell'ambito della telefonia mobile (MSc Thesis 2005) D. Strollo
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.