TEST

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.


Let's have a RESTful conversation

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

Abstractions

Microservices

Interfaces

Conversations

Multiple interactions (message exchanges) between two or more participants to achieve a goal

G. Hohpe

What is REST?

RESTful Conversations

Examples

?

GET /booking/42?payment HTTP/1.1
HTTP/1.1 302
Link: </payment?booking=42>; rel="payment"
GET /payment?booking=42 HTTP/1.1
HTTP/1.1 200

Long Running Task

POST /slow HTTP/1.1
HTTP/1.1 202 Accepted
Location: /slow/42

...

GET /slow/42
HTTP/1.1 200

...

GET /slow/42
HTTP/1.1 303 See Other
Location: /result/42
GET /result/42
HTTP/1.1 200

Try-Confirm/Cancel (TCC)

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

RESTful Conversation

Services control the conversation by embedding links into representations/responses

Clients drive the conversation by deciding which link to follow

Services only reveal the immediate next steps

Clients need to understand the link relation semantics to choose the link to follow

How to model RESTful Conversations?

BPMN

Software Connectors

BPMN and Software Connectors

Real World Example

AirBnB Conversation

GuestAirBnBHost

State (in)visibility

Where can you find the reservation in the model?

At the end, one Participant gets notified, the other just knows the outcome

Interaction abstraction

email notifications for state changes driven by HTTP POST (form submission) or timeouts

What if a participant wants to track the progress, check the status?

What if a participant wants to cancel the reservation?

Hypermedia

email notifications for state changes include a hyperlink to continue the conversation with other form submissions (HTTP POST)

How is the link correlated with the process/task instance?

Modeling Challenges

Define resource lifecycle (creation, destruction, updates and allowed state transitions)

Represent how to embed hypermedia controls (links, forms) as part of messages/representations

BPMN 2 Choreography

RESTful Choreography

Modeling Challenges

Define resource lifecycle (creation, destruction, updates and allowed state transitions)

Represent how to embed hypermedia controls (links, forms) as part of messages/representations

Capture recurring conversation patterns

(Some) Conversation Patterns

Redirection

Editable Resource

Long Running Request

RESTful conversations

References

Ack: Gregor Hohpe, Silvia Schreier, Ana Ivanchikj, Florian Haupt, Frank Leymann, Mathias Weske, Adriatik Nikaj, Sankalita Mandal, Guy Pardon

GuestAirBnBHost

Use a spacebar or arrow keys to navigate