Skip to content

Can the discovery API be de-coupled from the Endpoint? #463

Closed
@yurishkuro

Description

This is more of a wish list item, but let me at least describe the use case. In go-kit the discovery API is defined in terms of Endpoints, which can be used directly to make RPC calls. However, there are cases when I want to use just the discovery, i.e. finding the locations of other services, because I need to use some other APIs to call those services. Two concrete examples:

  1. my service talks to a Cassandra cluster. I could use discovery API during start-up of my service to find the seed Cassandra nodes that I can give to gocql driver.
  2. two of my services are communicating via TChannel, which is designed to balance the load internally against a list of peers, and the peers can be configured and changed dynamically, e.g. via updates from the discovery service.

It is not impossible to solve these two use cases with go-kit. If the Endpoint was an interface, I could implement it with a special struct that stores the string location of the remote service, and the actual Call function would be no-op. Then I could downcast the Endpoints returned from discovery to this struct and use it in the two above use cases. Given that the Endpoint is not an interface, I could still solve this by implementing the call function to return the struct with the location of the service.

Both of these approaches wouldn't be needed if the discovery API was defined in terms of service locations, as a basic discovery layer, while the current API could've been a wrapper around it for people who could use the Endpoints for RPC calls directly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions