Asynchronous communication

There is always an exception to this rule, but please do make it a rule: Don't send synchronous requests within your user-facing API services – make everything asynchronous whenever feasible. To explain this a bit better, let's take a look at an example.

You have a user-facing service that is called UserService. Within that service, you need to verify the user's address from AddressService. Because UserService is user-facing, meaning clients (users) are requesting information from it, it should respond as quickly as possible. For it to respond as quickly as possible, we should implement the address check asynchronously, detached from the user request. This means that user requests will never be combined with an ...

Get Hands-On Swift 5 Microservices Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.