Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no...

105
Orchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system is a choreography n Let starts with an example: w Consider the popular OpenID protocol for distributed authentication via third party services Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Transcript of Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no...

Page 1: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Orchestration vs Choreography

u In many cases, there is no unique point of invocation for the services n  In these cases, we say that the system is a

choreography n  Let starts with an example:

w Consider the popular OpenID protocol for distributed authentication via third party services

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 2: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

OpenID

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

1. User sends username

Page 3: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

OpenID

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

2. Username is forwarded

1. User sends username

Page 4: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

OpenID

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

1. User sends username

3. User sends password

2. Username is forwarded

Page 5: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

OpenID

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

2. Username is forwarded

4. Authorized/ Not authorized

1. User sends username

3. User sends password

Page 6: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

How to model choreographies?

u Several approaches are usually adopted to model (and program) choreographies n  MSC (Message Sequence Charts) n  Cryptographic protocol notation n  Open workflow nets n  Collaboration diagrams n  Process calculi-like languages n  …

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 7: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Message Sequence Chart for OpenID

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 8: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Message Sequence Chart for OpenID

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

1. User sends username

Page 9: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Message Sequence Chart for OpenID

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

1. User sends username 2. Username is

forwarded

Page 10: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Message Sequence Chart for OpenID

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

1. User sends username 2. Username is

forwarded

3. User sends password

Page 11: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Message Sequence Chart for OpenID

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

1. User sends username 2. Username is

forwarded

3. User sends password

4. Authorized/ Not authorized

Page 12: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Chryptographic protocol notation

u (Part of the) Needham-Schroeder authentication with public key:

A → B: {nA, A}kB

B → A: {nA, nB}kA

A → B: {nB}kB

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 13: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Chryptographic protocol notation

u A man-in-the-middle attack at the Needham-Schroeder protocol:

A → I: {nA, A}kI I → B: {nA, A}kB B → I: {nA, nB}kA I → A: {nA, nB}kA A → I: {nB}kI I → B: {nB}kB

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 14: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Chryptographic protocol notation

u The patched Needham-Schroeder-Lowe protocol:

A → B: {nA, A}kB

B → A: {nA, nB, B}kA

A → B: {nB}kB

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 15: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Open workflow nets

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

u Each partner is modeled by a Petri net with input/output places n  The partners are

combined by merging their input/output places

Page 16: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Collaboration diagram

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 17: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Collaboration diagram

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

u Two kinds of dependencies among events

n  Local dependencies: total ordering of the events on the same channel (A2 follows A1)

n  Causal dependencies: A2/C2 indicates that C2 causally depends on A2

Page 18: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

The process-calculus approach

u The process-calculus approach: n  Define the basic actions … n  ... define operators to combine actions thus

obtaining processes u Approach adopted in the most popular

choreography language in the context of Web Services: n  WS-CDL: Web Service Choreography

Description Language Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 19: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

WS-CDL approach u Global view of service interactions

Buyer

Seller

Bank Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 20: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

WS-CDL approach u Global view of service interactions

Buyer

Seller Request

Bank Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 21: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

WS-CDL approach u Global view of service interactions

Buyer

Seller

PayDescr

Request Offer

Bank Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 22: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

WS-CDL approach u Global view of service interactions

Buyer

Seller

PayDescr

Request Offer

Bank

Payment

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 23: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

WS-CDL approach u Global view of service interactions

Buyer

Seller

PayDescr

Request Offer

Bank

Payment Confirm

Receipt

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 24: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

WS-CDL approach

RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; PaymentBuyeràBank ; ( ConfirmBankàSeller | ReceiptBankàBuyer )

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 25: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

WS-CDL approach

RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; PaymentBuyeràBank ; ( ConfirmBankàSeller | ReceiptBankàBuyer )

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Basic Action Buyer sends a message

“Request” to Seller

Page 26: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

WS-CDL approach

RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; PaymentBuyeràBank ; ( ConfirmBankàSeller | ReceiptBankàBuyer )

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Sequential composition

Basic Action Buyer sends a message

“Request” to Seller

Page 27: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

WS-CDL approach

RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; PaymentBuyeràBank ; ( ConfirmBankàSeller | ReceiptBankàBuyer )

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Sequential composition

Parallel composition

Basic Action Buyer sends a message

“Request” to Seller

Page 28: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Interaction Oriented Approach

u In the WS-CDL approach the basic action corresponds to n  a sender that sends a message on an

operation exposed by a receiver n  this is the so-called global view approach

u Easy to formalise … we will see:

I. Lanese, C. Guidi, F. Montesi, G. Zavattaro: Bridging the Gap between Interaction- and Process-Oriented Choreographies. Proc. of SEFM 2008: 323-332

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 29: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Choreography process calculus

u We have defined a choreography process calculus

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Basic Action r sends a message a to s

Choice

Sequential

Parallel

Repetition

Page 30: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Choreography operational semantics

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Ready to terminate

Final completion

Page 31: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

A simple choreography (1)

u A client sends a reservation request to a travel agency, which contacts an airplane company and a hotel, and finally notify the client by confirming or cancelling the reservation:

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 32: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

A simple choreography (2)

u A client negotiates with a shop the price for a product she initially indicates

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 33: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Subtleties in choreographies

u Suppose the decision to Decline is taken by the client:

u Are there possible problems with this choreography?

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 34: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Possible problems

u Intuition: problems could depend on the kind of communication n  Synchronous: (no problem) client and

shop synchronise on the branch to select n  Asynchronous: (problem) client and shop

could select different branches (by emitting inconsistent messages)

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 35: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Choreography correctness

u We have performed a formal study of choreography correctness n  A calculus for choreography (similar to

the previous one, without repetition) n  Canonical projection:

w syntactic extraction from the choreography of the behaviour of the single roles

n  Check that the parallel composition of the projections behaves like the choreography

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 36: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

IOC: Interaction Oriented Choreography calculus

u We have defined an Interaction Oriented Choreography (IOC) calculus

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Basic Action a sends a message o to b

Sequence

Parallel Choice

Page 37: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

IOC: Interaction Oriented Choreography calculus

u We have defined an Interaction Oriented Choreography (IOC) calculus

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Success Failure

Page 38: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

IOC: operational semantics

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 39: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

POC: Process Oriented Choreography calculus

u We have defined a Process Oriented Choreography (POC) calculus

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Process P playing role a Choreography

Processes Receive Send

Page 40: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

POC: operational semantics -Processes-

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 41: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

POC: operational semantics -Choreographies-

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 42: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

POC: the client-shop example

u Here is the behaviour of the client and the shop in the first of the two already considered choreographies:

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 43: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

POC: the client-shop example

u Here is the alternative version where the client sends the decline message:

u No problem: there are three possible

choices (Price, Confirm, and Decline) and the client / shop synchronize in taking this decision!

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 44: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Formal correspondence u The IOC and the POC:

have exactly the same traces of transitions in the operational semantics

u Here is the alternative version where the client sends the decline message:

u No problem: there are three possible

choices (Price, Confirm, and Decline) and the client / shop synchronizes in taking this decision!

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 45: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Canonical projection

u In the previous example, the behaviour of the roles in the POC is obtained from the IOC by means of projection:

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 46: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

The OpenID Example

u The OpenId IOC:

and the projected POC:

u No Problem! Same traces! Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 47: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

An alternative end of OpenID u Consider the following alternative end:

and its projection:

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 48: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

An alternative end of OpenID u Consider the following alternative end:

and its projection:

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 49: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Choreography correctness

u Is it possible to check the correctness of a choreography? n  Yes: by controlling three independent

conditions w Connectedness for sequence w Unique point of choice w Causality safety

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 50: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Connectedness for sequence

u Intuition: n  Given the choreography C;D the rhs D

should start only when the lhs C has completed

n  We check this condition by controlling that among the roles involved in the completion of C there is at least one role involved in the starting of D

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 51: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Initial and final transitions u The functions transI and transF return

the interactions in the starting and completion of a choreography

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 52: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Connectedness for sequence: formally

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

u The last action before a sequential composition will surely occur before every possible intial action after n  guaranteed by the involvement of at least

one role in both actions

Page 53: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Connectedness for sequence

u Here is a trivial example of an incorrect choreography:

having the following projection:

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 54: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Unique point of choice

u Intuition: n  Given the choreography C+D all the

involved roles should agree on the branch to select: w When an initial action in one branch occur, all

the initial actions in the other one should be disabled

w The selected branch must be communicated to all partners, hence the partners involved in C and in D must be the same

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 55: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Unique point of choice: formally

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

u Every pair of initial actions in the two branches must include a common role: n  this role will be the unique point of choice n  moreover, the selected branch must be

communicated to all involved roles

Page 56: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Unique point of choice

u Here is a trivial example of an incorrect choreography:

having the following projection:

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 57: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Causality safety u Intuition:

n  If an operation occurs twice in a choreography, the two interactions should be not active contemporaneously

n  Consider the following choreography:

with the projection:

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 58: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Causality safety: formally

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

u The relation ≤s formalises causal dependencies n  hence if x ≤s y the two events x and y

cannot be both ready to be executed

Page 59: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Causality safety: formally

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

u The relation ≤s formalises causal dependencies n  hence if x ≤s y the two events x and y

cannot be both ready to be executed

Page 60: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise

u Which condition is not satisfied in the wrong alternative OpenID end?

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 61: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise

u Which condition is not satisfied in the wrong alternative OpenID end?

Connectedness for sequence: ?

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 62: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise

u Which condition is not satisfied in the wrong alternative OpenID end?

Connectedness for sequence: ✔

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 63: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise

u Which condition is not satisfied in the wrong alternative OpenID end?

Unique point of choice: ?

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 64: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise

u Which condition is not satisfied in the wrong alternative OpenID end?

Unique point of choice: ✔

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 65: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise

u Which condition is not satisfied in the wrong alternative OpenID end?

Causality safety: ?

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 66: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise

u Which condition is not satisfied in the wrong alternative OpenID end?

Causality safety: ✗

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 67: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Let’s go back to the client-shop example

u Remember: possible problems if the

client sends Decline while the shop Price n  This could happen in asychronously

communicating systems Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 68: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Asynchronous choreography correctness

u We have defined asychronous communication for POCs n  We have defined the correspondence

between IOCs and their asynchronous execution w More complex because send and receive events

are disjoint in POCs

n  We have revisited the three correctness conditions that guarantee correspondence

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 69: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

POC: Asynchronous semantics

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 70: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

POC: Asynchronous semantics

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 71: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Correspondence relation

u At the level of POC the interaction coincides with the receive event n  Hence, interaction correspondence

guarantees correspondence of receive (send could not correspond)

n  See the choreography:

with projection:

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 72: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Several correspondence relations

u The previous correspondence is named receiver correspondence n  We have considered

a lattice of correspondence relations

n  In the literature, receiver seems the mainly considered correspondence

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 73: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Receiver connectedness for sequence

u There are two ways to preserve the receive events in a sequential composition C ;D n  the receiver in C is the emitter in D

n  the receiver in C is also the receiver in D

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 74: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Receiver connectedness for sequence

u There are two ways to preserve the receive events in a sequential composition C ;D n  the receiver in C is the emitter in D

n  the receiver in C is also the receiver in D

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 75: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Asynchronous unique point of choice

u In an asynchronous setting, the emitter can locally decide to send a message n  In a choice only the emitter decide a branch

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 76: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Asynchronous causality safety

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

u Same definition, but with a relation ≤a that formalises causal dependencies for the asynchronous semantics

Page 77: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Asynchronous causality safety

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

u Same definition, but with a relation ≤a that formalises causal dependencies for the asynchronous semantics

Page 78: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise: the initial WS-CDL example

RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; PaymentBuyeràBank ; ( ConfirmBankàSeller | ReceiptBankàBuyer )

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 79: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise: the initial WS-CDL example

RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; PaymentBuyeràBank ; ( ConfirmBankàSeller | ReceiptBankàBuyer ) Asynchronous unique point of choice: ?

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 80: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise: the initial WS-CDL example

RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; PaymentBuyeràBank ; ( ConfirmBankàSeller | ReceiptBankàBuyer ) Asynchronous unique point of choice: ✔

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Trivial

Page 81: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise: the initial WS-CDL example

RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; PaymentBuyeràBank ; ( ConfirmBankàSeller | ReceiptBankàBuyer ) Asynchronous causality safety: ?

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 82: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise: the initial WS-CDL example

RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; PaymentBuyeràBank ; ( ConfirmBankàSeller | ReceiptBankàBuyer ) Asynchronous causality safety: ✔

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Trivial

Page 83: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise: the initial WS-CDL example

RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; PaymentBuyeràBank ; ( ConfirmBankàSeller | ReceiptBankàBuyer ) Asychronous connectedness: ?

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 84: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise: the initial WS-CDL example

RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; PaymentBuyeràBank ; ( ConfirmBankàSeller | ReceiptBankàBuyer ) Asychronous connectedness: ✔

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 85: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise: try to remove the Payment RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; ( ConfirmBankàSeller | ReceiptBankàBuyer )

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 86: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise: try to remove the Payment RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; ( ConfirmBankàSeller | ReceiptBankàBuyer ) Asynchronous unique point of choice: ✔

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Trivial

Page 87: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise: try to remove the Payment RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; ( ConfirmBankàSeller | ReceiptBankàBuyer ) Asynchronous causality safety: ✔

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Trivial

Page 88: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise: try to remove the Payment RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; ( ConfirmBankàSeller | ReceiptBankàBuyer ) Asychronous connectedness: ?

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 89: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Exercise: try to remove the Payment RequestBuyeràSeller ; ( OfferSelleràBuyer | PayDescrSelleràBank ) ; ( ConfirmBankàSeller | ReceiptBankàBuyer ) Asychronous connectedness: ✗

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

In an asynchronous setting there is no ordering guarantee (while it is guaranteed for synchronous communication!)

Page 90: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

What to do with choreographies ? u You are now among the greatest

worldwide experts in choreographies! n  so what? …

u Don’t worry... you didn’t lose your time n  There is at least one programming

language that you can use to realise your distributed systems using choreographies

Marco Carbone, Fabrizio Montesi: Deadlock-freedom-by-design: multiparty asynchronous global programming. Proc. of POPL 2013: 263-274

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 91: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Choreography programming

u A IOC-like language is used to specify the possible communication protocols used in the system

u An enriched choreography language (variables, if-then-else, functions, ..) is used to specify the overall system

u End-point programs are obtained by means of projection (written in Jolie)

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 92: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

The approach: graphically

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 93: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Chor: basic ideas

u Describe the behaviour of processes in a system: n  Each process has a local state n  Processes take part to multiparty

conversations, tracked as sessions n  Sessions are started through public

channels (e.g., URLs). n  Both sessions and processes can be

dynamically created Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Page 94: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Alice and Bob buy a book together

Page 95: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Alice and Bob buy a book together

Page 96: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Alice and Bob buy a book together

Page 97: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Alice and Bob buy a book together

Page 98: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Alice and Bob buy a book together

Page 99: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Alice and Bob buy a book together

Page 100: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Alice and Bob buy a book together

Page 101: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Alice and Bob buy a book together

Page 102: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Alice and Bob buy a book together

Page 103: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Alice and Bob buy a book together

Page 104: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Alice and Bob buy a book together

Page 105: Orchestration vs Choreography - Plone siteOrchestration vs Choreography u In many cases, there is no unique point of invocation for the services n In these cases, we say that the system

Bertinoro 7-11/3/2016 Models and Languages for Service-Oriented and Cloud Computing

Alice and Bob buy a book together