Skip to content
Diogo Santos edited this page Nov 11, 2019 · 5 revisions

FrontierAPI is an approach to solve transactions spread across different microservices. FrontierAPI is not JTA compliant, and it is not intended to be a XA like transaction, for which the resource locks for a reasonable amount of time. Solutions like XA transactions, end up in strong coupling between services and limiting the concurrency.

FrontierAPI is intended to follow microservices pattern, to maintain its loose coupling while maintaining a consistent state of representation across the different microservices, to do so it provides a set of annotations to the developer, so he can easily decouple services, although some limitations regarding the CAP theorem need to be taken into account when applying those annotations, otherwise the state of the domain won't be fully represented as if it was in a monolithic approach.

To the FrontierAPI, all microservices are consider participants. When a participant makes a transaction annotated with FrontierAPI it will make a request, based on the provided guarantees, to the micrsoservice handling that transaction locally. It's the participant responsibility to register in the FrontierAPI how to compensate the transaction, so if should it fail the FrontierAPI will compensate the transaction in the given microservice, being this replicated by all the participants of the transaction.

As an example, when a Pet Owner schedules a visit to the Vet, the Visit Service may take an optimistic approach and schedule the visit for a particular hour, even though the Vet may already have that hour filled. For this specific case the participant would register a compensation transaction in the API to undo the schedule of the appointment.

Sequence Diagram

Clone this wiki locally