#development (tag)

Service autodiscovery in Go with sleuth

Service discovery and remote procedure calls (RPC) are big subjects. There are many existing solutions that require varying degrees of infrastructure (e.g. message queues, Consul) or architectural decisions (e.g. Erlang, Akka, etc.). In this post, I’ll introduce a minimalistic Go library called sleuth that creates an ad hoc peer-to-peer network requiring almost no configuration and only a couple lines of code to existing services and clients.

sleuth is a library that lets web services announce themselves to each other and to other clients on a LAN. It allows peers to send requests to each other without having to coordinate where each one lives and what port it uses. It works without an external process because under the hood, it is powered by magic, *a.k.a.* ØMQ using the Gyre port of Zyre.

The anatomy of a Go project

There are a lot of resources about getting started in Go and places where a beginner can play around and become comfortable with the language. This tutorial is about taking the next steps: building robust projects that are fully documented, tested, and usable by the Go community.