Scheduler - Supervisor
User
placesa
new order
WorkerRole task
(“Supervisor”)
SB Topics
“new
order”
Orders
Job Store
The order and a ProcessOrder
record are inserted using the same
database transaction, and the user
receives the confirmation that the
new order has been placed
1
2
“Checks-out” the “failed” or
“timeout” records and
resume the process from
where it failed
OrderId:154, LockedBy: null,
LockedUntil: null,
ProcessCount:0, Status: Not
processed, Timeout:xx sec
Id:154, Ammount:$ 1000,
Address…
One-to-one
relationship
SB reply
queue
WorkerRole task
(“Scheduler”)
WebRole
Sends the “new order”
message to Topics
Asynchronously
4
The worker role
receives “order
received” message
from queue
6Update the record w/
“request sent”
5
Gets the record w/ “Not
processed” owned by WR
3
Update the record w/
“request received”7
“Check-out”:
Update ProcessOrders
Set
LockedBy =
‘unique worker role
instance ID’,
LockedUntil = now + X
Where
Status = (Not processed OR
Processed with Errors) AND
LockedUntil < now