Guy Pardon, ATOMIKOS
[email protected]
@atomikos
Cesare Pautasso, University of Lugano, Switzerland
[email protected]
@pautasso
Single state transfers from/to
the client are idempotent
How do we make both interactions atomic?
ACID
ATOMIC
POST /booking HTTP/1.1
Host: api.swiss.com
HTTP/1.1 201 Created
Location: /booking/{id}
PUT /booking/{id} HTTP/1.1
Host: api.swiss.com
Accept: application/tcc
HTTP/1.1 204 No Content
DELETE /booking/{id} HTTP/1.1
HTTP/1.1 204 No Content
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" }
}
PUT /booking/{id} HTTP/1.1
Host: api.swiss.com
Accept: application/tcc
HTTP/1.1 404 Not Found
Participants indicates confirmation link expired
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
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
Confirm multiple reservations atomically
PUT /coordinator/confirm HTTP/1.1
Host: www.taas.com
Content-Type: application/tcc+json
{
"transaction": [ {
"uri": "http://www.example.com/part/123",
"expires": "2014-04-09T10:15:54.261+01:00"
},
{
"uri": "http://www.example.com/part/234",
"expires": "2014-04-08T10:15:54.261+01:00"
} ]
}
HTTP/1.1 204 No Content
HTTP/1.1 409 Conflict
Cancel multiple reservations atomically
PUT /coordinator/cancel HTTP/1.1
Host: www.taas.com
Content-Type: application/tcc+json
{
"transaction": [ {
"uri": "http://www.example.com/part/123",
"expires": "2014-04-09T10:15:54.261+01:00"
},
{
"uri": "http://www.example.com/part/234",
"expires": "2014-04-08T10:15:54.261+01:00"
} ]
}
HTTP/1.1 204 No Content
Workflow models happy path + completion
The model is:
An interoperability risk exists if: two endpoints need to communicate, and both are outside your control
With TCC, participating services do not need to know the coordinator (unlike WS-*)
A service call can carry a transaction context, but still the service can ignore it!
WS-AT is ACID, meaning locks
Implementation available from http://www.atomikos.com
Guy Pardon, ATOMIKOS
[email protected]
@atomikos
Cesare Pautasso, University of Lugano, Switzerland
[email protected]
@pautasso
Agreement is reached if the confirmation phase ends before the resources undo the state transitions because of the timeouts
If the confirmation runs longer than the earliest timeout, agreement cannot be guaranteed
(heuristic exception)
Use a spacebar or arrow keys to navigate