O'Reilly logo

TypeScript Microservices by Parth Ghiya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The fallback and compensating transaction pattern

In this pattern, whenever a remote service call fails, rather than generating an exception, the consumer will try to carry out an alternative way to do that action. Ways to achieve this usually include looking for data from an alternate data source (let's say cache) or queuing user's input for future processing. Users will be notified that their requests will be addressed later on and if all routes fail the system tries to compensate whatever actions that have been processed. Some common approaches to fallback that we use are (as highlighted by Netflix):

  • Cache: Get data from local or remote cache if the real-time dependency is missing, periodically refresh cache data to avoid stale data

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required