+ All Categories
Home > Documents > From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni,...

From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni,...

Date post: 19-Dec-2015
Category:
View: 219 times
Download: 0 times
Share this document with a friend
Popular Tags:
42
From Theory to Practice in Transactional Composition of Web Service From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari, Emilio Tuosto University of Pisa University of Pisa
Transcript
Page 1: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

From Theory to Practice in Transactional Composition

of Web Services

Daniele StrolloDaniele StrolloRoberto Bruni,Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,Emilio Tuosto

University of PisaUniversity of Pisa

Page 2: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Schedule

Introduction to Sagas Basic concepts of JTWS Java Signal Core Layer (JSCL) Java Transactional Layer (JTL) Examples

Page 3: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Long Running Transactions

Transactions in e-Business scenario ACID properties are relaxed:

atomicity (long running) isolation (concurrency).

LRTs with compensation as solution to failures: undo alternatives to restoring of state (e.g. refund money…)

Plain ReservationService

Reservation Request

Payment Service:• bank account (atomicity)• credit card (isolation)

Request for canceling reservation

Payment

Page 4: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Long Running Transactions…

Long-Running Transactions (LRTs): Independent components loosely coupled Each component maintains the consistency of its local

data Illusion of Atomicity given by compensations

Ad-hoc activities responsible for undoing the effects of partial executions when the whole computation cannot be completed.

Current proposals lack from formal foundations Hard to prove properties

Page 5: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Our goal

To provide a formally specified language for defining transactional aggregations at high level of abstraction.

To map high level transactional primitives into concrete coordination patterns.

Page 6: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Saga Calculus (SC): syntax

Atomic activities: [ {0, THROW} Ranged over by A, B, …

Processes: P ::= A ¥ B | P;P | P||P

Sagas: S ::= A | [P] | S;S | S||S

Saga Calculus naturally abstracts away from low level computational details and communication patterns [BMM@POPL05].

The formal semantics is given by traces [BHF@25YCCS,BBFHMM@CONCUR05].

Page 7: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Basic concepts of SC: compensable process

Compensable process:

P = A¥B P executes the main activity A and installs

the compensation activity B B is not installed if A is not completely

executed A is called forward flow and B the backward

flow

A ¥ B

Page 8: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Basic concepts of SC: Saga

The process P contained in a Saga SS ::= [P]

Encloses the execution of process P in an “atomic context”.The execution of successful backward flow is isolated from the outside.Only in case of unsuccessful compensation action, the event is forwarded to previous stages.

Page 9: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Purchase orders

Accept Order

Update Credit

Prepare Order

Page 10: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Purchase orders without compensations

Accept Order

Update Credit

Prepare Order

S = [ AO ; UC | PO ]

The possible traces are: ` S = {< , , >< , , >}AOAO UCUC POPO AOAO UCUCPOPO

Page 11: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Purchase orders with compensations

Accept OrderRefuse Order

Update CreditRefund Money

Prepare OrderUpdate Stock

S = [ AO¥RO ; UC¥RM | PO¥US ]

Successful execution: ` S = {<AO, UC, PO, X><AO, PO, UC, X>}

Failure with successful compensation (not enough money):’ ` S = {<AO, PO, US, RO, X>}

Failure and unsuccessful compensation (unable to resemble stock):’’ ` S = {<AO, PO, !>}

Page 12: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Schedule

Introduction to Sagas Basic concepts of JTWS Java Signal Core Layer (JSCL) Java Transactional Layer (JTL) Examples

Page 13: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTWS Architecture

JTL (Transactional

Layer)

JSCL (Signal Core Layer)

JTWS

JSCL defines:

Async/sync signal passing

Signal links

Logical ports

Handler/Emitter

Generic Component

management of flow sessions

JTL defines:

Types of signals useful to represent LRTs

Sequential and Parallel composition of services

Page 14: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Schedule

Introduction to Sagas Basic concepts of JTWS Java Signal Core Layer (JSCL) Java Transactional Layer (JTL) Examples

Page 15: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JSCL: application building blocks

Signal Links: unicast unidirectional typed

Emitter HandlerSigType

Agents: Signal Emitter Signal Handler

Resource

Sig

nal

Inp

ut P

ort

s Sign

al Output P

orts

Agent

Signals: Abstraction of an event Typed

Session InternalData

Logical Ports AND / OR / NOT

SIG_TRUE

SIG_FALSE

SIG_TRUE

SIG_FALSE

Page 16: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Example

Resource

AgentB Resource

AgentC

Resource

AgentD

Resource

AgentA

eventTypen

eventType1

Page 17: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JSCL in detail

connectSignal

registerSignalJTWSComponent

JTWSComponent

Connecting two components: The Emitter makes a request to a handler to be connected The Handler gives the permissions to the Emitter to create the input signal link

Page 18: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JSCL in detail

emitSignal

handleSignalJTWSComponent

JTWSComponent

Queue

Connecting two components: The Emitter makes a request to a handler to be connected The Handler gives the permissions to the Emitter to create the input signal link

Forwarding a signal: Emitter: emitSignal (signal, async) Handler: the method handleSignal (signal, async) is invoked automatically . This method “propagates” the signal to all the registered handlers.

The asynchronous signals are managed by the handler.

Page 19: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Schedule

Introduction to Sagas Basic concepts of JTWS Java Signal Core Layer (JSCL) Java Transactional Layer (JTL) Examples

Page 20: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Cmt

Rb

Exc

Inv

JTWS: Java Transactional Layer (JTL)

Prefixed set of signals with a precise semantics:

SNG_INVOKE,

SGN_COMMIT,

SGN_ROLLBACK

Structural composition of services:

Sequence and Parallel

Well defined semantics for transactional flows.

JTL Component

Page 21: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: AtomicTask

AtomicTask defines the interface that each atomic activity of SC must fit.

We assume that any class which implements AtomicTask cannot throw any exception but AtomicActionException.

Page 22: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: Basic Compensable Process

A SC compensable process is defined in JTL as:

Comp (A, B) Comp (A, B) ´́ A A ¥¥ B B

with A,B AtomicTasks. The forward flow corresponds to the execution of A. The backward flow corresponds to the the execution

of B. Exceptions are raised in presence of faults during

execution of B.AA

BB

Page 23: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: Basic Compensable Process...

AA

BB

Inv

Executes main activity ASuccessful execution of A

Inv

Unsuccessful execution of A

Rb

Request for abort.Executes B.

Compensation failure

Rb

Compensation successful executed

Exc

snatch
aggiungere propagazione segnali
Page 24: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: sequence

Seq (P, Q) Seq (P, Q) ´́ P;Q P;Q

JTLSequence.addInternalComponent (JTLComponent) permits to add new components in the sequence.

In Out

iRb

iEx

oRb

oEx

oCt iCtPP

seq.addInternalComponent (Q)

Page 25: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: sequence

In Out

iRb

iEx

oRb

oEx

oCt iCtPP QQ

Page 26: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: sequence

In Out

iRb

iEx

oRb

oEx

oCt iCtPP QQ

AAInv

Page 27: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: sequence

In Out

iRb

iEx

oRb

oEx

oCt iCtPP QQ

Inv

Page 28: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: sequence

In Out

iRb

iEx

oRb

oEx

oCt iCtPP QQ

BBRb

Page 29: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: sequence

In Out

iRb

iEx

oRb

oEx

oCt iCtPP QQ

BBRb

Page 30: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: sequence

In Out

iRb

iEx

oRb

oEx

oCt iCtPP QQ

Rb

Page 31: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: parallel

In Out

iRb

iEx

oRb

oEx

oCt iCt

CollectorCollector

DispatcherDispatcher

InvInv

PP

QQ

Status = (-,-)

Par (P, Q) Par (P, Q) ´́ P|Q P|Q

Page 32: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: parallel

In Out

iRb

iEx

oRb

oEx

oCt iCt

CollectorCollector

DispatcherDispatcher

PP

QQ

AA

AA

Status = (---,---)

Inv

Page 33: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: parallel

In Out

iRb

iEx

oRb

oEx

oCt iCt

CollectorCollector

DispatcherDispatcher

PP

QQ

AA

AA

Status = (Inv,---)

Inv

Page 34: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: parallel

In Out

iRb

iEx

oRb

oEx

oCt iCt

CollectorCollector

DispatcherDispatcher

PP

QQ

AA

AA

Status = (Inv,Inv)

Inv

Page 35: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Saga in JTL

The behavior of a Saga S ::= [P] in JTL is the following:

If P sends an Inv signal: S propagates internally the Cmt signal S sends externally the Inv signal

If P sends an Rb signal: S sends externally the Inv signal

If P sends an Exc signal: It is ignored since the status is inconsistent

Page 36: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTL: saga

In Out

PP

SignalHSignalHExc and Cmt ignored while

Abt is transformed

to Inv

Page 37: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Schedule

Introduction to Sagas Basic concepts of JTWS Java Signal Core Layer (JSCL) Java Transactional Layer (JTL) Examples

Page 38: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Purchase Order in JTL

Accept OrderRefuse Order

Update CreditRefund Money

Prepare OrderUpdate Stock

S = [ AO¥RO ; UC¥RM | PO¥US ]

Seq ( Comp (AO, RO), Par ( Comp (UC, RM), Comp (PO, US)))

Page 39: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Purchase Order in JTL: graphical representation

Out

iEx

UCUC

POPO

iRb

iCt

In

oEx

oRb

oCt

RMRM

USUS

AOAO

RORO

Out

iEx

iRb

iCt

In

oEx

oRb

oCt

Page 40: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

JTWS: advantages

JSCL Basic framework for programming coordination. Abstraction for communication details. Logical ports permit a simple design of the flow diagrams. The connections can be modified at run-time. Distributed flow execution. Primitives for authorizing access to signals.

JTL Based on a robust theory Simple to program Extendible to other transactional logics

Page 41: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

Concluding remarks

From a formal specification of naïve sagas we have presented JTWS.

Contribution is a setting for designing business process transactions Visual/graphical representation of parallel sagas Process calculus description in bijective correspondence with sagas

diagrams Executable, distributed translation of symbolic processes

Future works GUI to develop JTL and JSCL components Debugger environment to test the behavior of the involved

components Support for advanced features like nesting, speculative choice (N.

Zappone).

Page 42: From Theory to Practice in Transactional Composition of Web Services Daniele Strollo Roberto Bruni, Gianluigi Ferrari, Hernàn Melgratti, Ugo Montanari,

From Theory to Practice in Transactional Composition of Web Services

oOOo <(. .)> oOOo

?


Recommended