7.1. Remote Services Club
The first rule of remote service club is that you can't rely on remote services. I'm sure you can guess what the second rule is.
Any time you make a connection out from your application to another service, whether running locally on the same box, remotely on another box, or even in a different data center, there's a possibility that the service will be unavailable. The network could be down, the box could be down, the service could be down or malfunctioning. When planning connectivity with remote services, we need to constantly bear in mind that the service can (or, given a long enough timeline, will) fail.
The failure of a remote service then needs to be detected and dealt with. The steps to deal with a failure vary depending on the serviceautomatically failing over to an alternative, alerting the developers, alerting the user, or potentially rolling back a transaction. In this chapter we'll talk about the various failures that we might encounter and the strategies for dealing with them.