discovery

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

README

Discovery GoDoc

Discovery builds on the go-micro.Registry and is backed by the Micro OS discovery service.

The go-micro registry provides a simple Registry abstraction for various service discovery systems. Heartbeating is also done through a simple form of re-registration. Because of this we end up with a system that has limited scaling potential and does not provide much information about service health.

Discovery provides heartbeating as events published via the Broker. This means anyone can subscribe to the heartbeats to determine "liveness" rather than querying the Registry. Discovery also includes an in-memory cache of the Registry using the Watcher. If the Registry fails for any reason Discovery continues to function.

Usage

Run Discovery

Installation instructions

With Flag
import _ "github.com/micro/go-plugins/registry/discovery"
go run main.go --registry=os --registry_address=addr1:port,addr2:port,addr3:port
Direct Use
import (
	"github.com/micro/go-micro"
	"github.com/micro/go-plugins/registry/discovery"
)

func main() {
	r := discovery.NewRegistry(
		discovery.Addrs("addr1:port", "addr2:port", "addr3:port"),
	)

	service := micro.NewService(
		micro.Name("my.service"),
		micro.Registry(r),
	)
}

Documentation

Overview

Package discovery is an interface for scalable service discovery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRegistry

func NewRegistry(opts ...registry.Option) registry.Registry

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL