#Herald
Herald is a package intended to make your microservice compatible with multiple service discovery platforms throught the use of flags or environment variables.
Herald serves two functions.
Utilizing the service definition a service can declare its definition in a k/v store.
Currently supports etcd and consul.
Once again utilizing the service definition a system can become part of a pool of services for API routing.
Currently supports consul and vulcand
This package supports three flags and 3 environment variables. Flags take prescendence over environement variables and specificty takes prescedence over genrality.
--herald will set the declare and pool services to the same thing env (HERALD). Service must me both interface requirements.
--herald-p sets the pooling service only (HERALD_POOL)
--herald-d sets the declare service (HERALD_DECLARE)
Herald only acts if a pool or declaration or both have been set. Pool and declcarations are mutually independent so a user can mix and match services.
Herald has a registry of platforms currently supported and you can register all:
package main
import (
"github.com/duckbunny/herald/registry"
)
func init() {
registry.RegisterAll()
}
Herald has two interfaces
###Pool
type Pool interface {
Start(*service.Service) error
Stop(*service.Service) error
Init() error
}
New pool types can be created and registered utilizing the AddPool method.
my_new_pool = new(MyPoolStruct)
herald.AddPool("my_pool", my_new_pool)
which can then be invoked from a flag or env variable.
###Declaration
type Declaration interface {
Declare(*service.Service) error
Get(*service.Service) error
Init() error
}
New declaration types can be created and registered utilizing the AddDeclaration method.
my_new_declaration = new(MyDeclarationStruct)
herald.AddDeclaration("my_declaration", my_new_declaration)
which can then be invoked from a flag or env variable.
[![GoDoc](https://godoc.org/github.com/duckbunny/{{ .Name }}?status.svg)](https://godoc.org/github.com/duckbunny/{{ .Name }})
{{ .EmitHeader }}
{{ .EmitSynopsis }}
{{ .EmitUsage }}
docs generated by godocdown