Search code examples
service-discovery

Discovery service and order of services


To make this question simple, imagine I have two services:

  1. datastore
  2. business layer, that connects to datastore on startup.

Obviously, business layer must wait until datastore becomes ready before it can connect and use it.

How this 'dependency' relation is solved in the 'Discovery service' world (zookeeper, etcd...)? As far as i know, registries just keep the services information, and there is no dependency between the services.


Solution

  • There are at least two ways to address this problem:

    1. Service discovery protocol will register the IOPE (Input/Output/Preconditions or Postconditions/Effects) of a service. This dependency can be part of the Preconditions/Postconditions set.
    2. These two services can be part of a designed workflow. When discovering and composing services (either manually or automatically), the dependency can be realised by mapping the output of the first service (the business layer) to the input of the second service (the data store).