XX:YY

Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.

For the best experience please use the latest Chrome, Safari or Firefox browser.

image/svg+xml

RESTful Business Process Management

Cesare Pautasso
http://www.pautasso.info
[email protected]
@pautasso

University of Lugano (USI)

Faculty of Informatics

Architecture, Design and Web Information Systems Engineering

http://design.inf.usi.ch

Towards RESTful BPM

http://design.inf.usi.ch/research/restful-bpm

image/svg+xml ? Database Datamail

Decoupled Sharing

image/svg+xml World Wide Web PUT GET Database

Hypermedia

Discovery by Referral

image/svg+xml World Wide Web PUT GET Link World Wide Web PUT GET GET Link

Software Connectors

image/svg+xml Remote Procedure Call Asynchronous Messaging File Transfer Shared Database Stream World Wide Web

The Web as a Software Connector

image/svg+xml Send Receive PUT GET PUT GET GET Send Receive
image/svg+xml PUT GET PUT 200 GET 200
image/svg+xml PUT GET GET PUT DELETE

BP

image/svg+xml Process Execution Engine Process Designer Process Model Process Owner Process Instance Software Activities Human Activities
image/svg+xml Process Execution Engine Software Activities Human Activities GET /RPUT /RDELETE /RPOST /R RESTful service composition Process Model P Process Instance P.1 GET /P/1PUT /P/1DELETE /P/1POST /P/1 GET /PPUT /PDELETE /PPOST /P Publishing processes as resources Conversations

RESTful Process Engine API

image/svg+xml Process Model P Process Instance P.1 GET /P/1PUT /P/1DELETE /P/1POST /P/1 GET /PPUT /PDELETE /PPOST /P Task Instance P.1.T GET /P/1/TPUT /P/1/TDELETE /P/1/TPOST /P/1/T
image/svg+xml GET /process/name Content-Type: text/html application/atom+xml text/plain application/json image/svg+xml Web pagewith form to startthe process Feed withlinks to processinstances Content-Type: Content-Type: Content-Type: Content-Type: Natural languagedescription Metadata Diagram

Remote Process Call

POST /process/name HTTP/1.1

...after some time...

HTTP/1.1 200

Process Completed

Let's have a RESTful Conversation with a Process

POST /process/name?start HTTP/1.1
HTTP/1.1 201 Created
Location: /process/name/42
GET /process/name/42
HTTP/1.1 200
Link: </process/name/42/task>; rel="task"

Process Instance 42 is running
GET /process/name/42/task
HTTP/1.1 200
PUT /process/name/42/task
HTTP/1.1 200
GET /process/name/42
HTTP/1.1 200

Process Instance 42 is complete

Processes as Resources

Resources as Processes

Publish resources from processes that drive their internal state transitions

RESTful Process Engine API

REST Architectural Elements

image/svg+xml User Agent Origin Server HTTP
image/svg+xml User Agent Proxy HTTP Origin Server HTTP Cache
image/svg+xml Clients Proxy REST Service Cache

REST middleware is primarily designed to scale a single server, which may need to service a large number of clients

image/svg+xml Client CompositeREST Service REST Services

A Composite REST service provides an aggregated view over the state of multiple REST services

image/svg+xml GET /CPUT /CDELETE /CPOST /C GET /SPUT /SDELETE /SPOST /S GET /RPUT /RDELETE /RPOST /R

The behavior of /C is defined by
composing /R and /S

image/svg+xml /C /R /S

The composite resource /C only aggregates
the state of its components /R and /S

image/svg+xml /C /R /S

The composite resource /C augments or
caches the state of its components

image/svg+xml GET /CPUT /CDELETE /CPOST /C GET /SPUT /SDELETE /SPOST /S GET /RPUT /RDELETE /RPOST /R
image/svg+xml GET /CPUT /CDELETE /CPOST /C GET /SPUT /SDELETE /SPOST /S GET /RPUT /RDELETE /RPOST /R
image/svg+xml GET /CPUT /CDELETE /CPOST /C GET /SPUT /SDELETE /SPOST /S GET /RPUT /RDELETE /RPOST /R

Composing Representations with Hypermedia

image/svg+xml /R /S Link /S Link /R C

The composite representation C refers to its component resources /R and /S via hyperlinks

image/svg+xml REST Services REST Services Composite Client REST Service C CompositeRepresentation

A composite representation is interpreted by the client that follows its hyperlinks and aggregates the state of the referenced component resources

A composite representation may be retrieved from a composite service

Example: DoodleMap

image/svg+xml Google Maps Doodle Composite Client REST Service C CompositeRepresentation Yahoo!Local Search

Vote to choose a meeting place based on its geographic location

Composite REST Service

image/svg+xml GET /CDELETE /CPOST /C GET /DPUT /DDELETE /DPOST /D GET /YLS

Compose Yahoo! Local Search with Doodle

Composite REST Service

image/svg+xml GET /CDELETE /CPOST /C GET /DPUT /DDELETE /DPOST /D GET /YLS

Create a new poll using the locations

Composite Representation

image/svg+xml /M /C Link /C Link /M C /Y /D Link /D

Demo

RESTful service composition

The Context

image/svg+xml RESTful API PersistentStorage Database 2 Backend 1 REST servicelogic RESTful API REST servicelogic Backend 3

The Problem

image/svg+xml GET Client PUT

Single state transfers from/to
the client are idempotent

How do we make both interactions atomic?

ACID

ATOMIC

Constraints

Try-Confirm/Cancel

image/svg+xml Try FinalState Confirm InitialState Timeout ReservedState Cancel

TCC Participant's view

image/svg+xml TCC servicetryconfirmcancel Database

Try

POST /booking HTTP/1.1
Host: api.swiss.com
HTTP/1.1 201 Created
Location: /booking/{id}

Confirm

PUT /booking/{id} HTTP/1.1
Host: api.swiss.com
Accept: application/tcc
HTTP/1.1 204 No Content

Cancel

DELETE /booking/{id} HTTP/1.1
HTTP/1.1 204 No Content

TCC Example

image/svg+xml Phone NoService BookingProcess BillingService 1. bookPhoneForCustomer 1.1 R1 =reserveNumber 1.2 R2 = billCustomer TransactionCoordinator 1.3 confirmAll(R1, R2) 1.3.1 confirm(R1) 1.3.2 confirm(R2)

Failure before Confirm

image/svg+xml Phone NoService BookingProcess BillingService 1. bookPhoneForCustomer 2.2 Timeout 2.1Timeout 1.1 R1 =reserveNumber 1.2 R2 = billCustomer ATOMICAll participantstimeout

Failure after Confirm

image/svg+xml Phone NoService BookingProcess BillingService 1. bookPhoneForCustomer 1.1 R1 =reserveNumber 1.2 R2 = billCustomer TransactionCoordinator 1.3 confirmAll(R1, R2) 1.3.1 confirm(R1) 1.3.2 confirm(R2) ATOMICAll participantsconfirmed

Failure during Confirm

image/svg+xml Phone NoService BookingProcess BillingService 1. bookPhoneForCustomer 1.1 R1 =reserveNumber 1.2 R2 = billCustomer TransactionCoordinator 1.3 confirmAll(R1, R2) 1.3.1 RETRY confirm(R1) 1.3.2 RETRY confirm(R2) ATOMICAll participants(eventually) confirmed

Timeout during Confirm

image/svg+xml Phone NoService BookingProcess BillingService 1. bookPhoneForCustomer 1.1 R1 =reserveNumber 1.2 R2 = billCustomer TransactionCoordinator 1.3 confirmAll(R1, R2) 1.3.1 confirm(R1) 2.2 Timeout 1.3.2 confirm(R2) ERROR! HEURISTICEXCEPTION

Timeout?

POST /booking/ HTTP/1.1
Host: api.swiss.com
HTTP/1.1 200 OK
Content-Type: application/json

{"participantLink": 
  { "uri":"http://api.swiss.com/booking/{id}",
    "expires":"2014-04-07T10:15:54.261+01:00", 
    "rel":"tcc" }
}

After a Timeout

PUT /booking/{id} HTTP/1.1
Host: api.swiss.com
Accept: application/tcc
HTTP/1.1 404 Not Found
Participants indicates confirmation link expired

Workflow

Try to reserve multiple resources

POST /telephone HTTP/1.1
Host: api.swisscom.ch
HTTP/1.1 201 Created
Location: /telephone/0586664302
POST /bill HTTP/1.1
Host: api.post.ch
HTTP/1.1 201 Created
Location: /bill/42

If everything is successful, confirm the bookings

PUT /telephone/0586664302 HTTP/1.1
Host: api.swisscom.ch
Accept: application/tcc
HTTP/1.1 204 No Content
PUT /bill/42 HTTP/1.1
Host: api.post.ch
Accept: application/tcc
HTTP/1.1 204 No Content

Workflow

Try to reserve multiple resources

POST /booking HTTP/1.1
Host: api.swisscom.ch
HTTP/1.1 201 Created
Location: /telephone/0586664302
POST /bill HTTP/1.1
Host: api.post.ch
HTTP/1.1 500 Internal Server Error

Incorrect billing address

If something fails, do nothing.
The reserved resources will eventually timeout.

If something fails, a polite workflow would explicitly cancel the successful reservations

DELETE /telephone/0586664302 HTTP/1.1
Host: api.swisscom.ch
HTTP/1.1 200 OK

Conclusion: REST/TCC

TCC for REST

Implementation available from http://www.atomikos.com

References

Made with

http://asq.inf.usi.ch

Acknowledgements

Frank Leymann, Olaf Zimmermann, Florian Haupt, Silvia Schreier, Ana Ivanchikj, Guy Pardon, Mathias Weske, Adriatik Nikaj, Sankalita Mandal, Hagen Overdick, Jesus Bellido, Rosa Alarcón, Alessio Gambi, Daniele Bonetta, Achille Peternier, Erik Wilde, Mike Amundsen, Stefan Tilkov

Use a spacebar or arrow keys to navigate

Powered by
asq