This commit is contained in:
Ilkka Seppälä
2019-12-13 21:09:28 +02:00
parent 0335c61512
commit b2b1ba95eb
127 changed files with 282 additions and 450 deletions

View File

@ -3,10 +3,9 @@ layout: pattern
title: Commander
folder: commander
permalink: /patterns/commander/
categories: Other
categories: Concurrency
tags:
- Java
- Difficulty-Intermediate
- Cloud distributed
---
## Intent
@ -24,4 +23,5 @@ Handling distributed transactions can be tricky, but if we choose to not handle
We need a mechanism in place which can handle these kinds of situations. We have to direct the order to either one of the services (in this example, shipping) and then add the order into the database of the other service (in this example, payment), since two databses cannot be updated atomically. If currently unable to do it, there should be a queue where this request can be queued, and there has to be a mechanism which allows for a failure in the queueing as well. All this needs to be done by constant retries while ensuring idempotence (even if the request is made several times, the change should only be applied once) by a commander class, to reach a state of eventual consistency.
## Credits
* [https://www.grahamlea.com/2016/08/distributed-transactions-microservices-icebergs/]