servicediscovery

package
v0.0.301 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResolvedService

type ResolvedService struct {
	ID      string
	Address string
	Port    int
}

type ServiceDiscovery

type ServiceDiscovery struct {
	ConsulClient *consul.Client
	// contains filtered or unexported fields
}

ServiceDiscovery struct which holds connection.

func StartServiceDiscoveryAndRegisterService

func StartServiceDiscoveryAndRegisterService(sr *ServiceRegistration) (*ServiceDiscovery, error)

StartServiceDiscoveryAndRegisterService starts discovery connection ang registers service.

func (*ServiceDiscovery) DeregisterService

func (sd *ServiceDiscovery) DeregisterService() error

DeregisterService used with defer to deregister service if graceful shutdown.

func (*ServiceDiscovery) GetServices

func (sd *ServiceDiscovery) GetServices(servicename, tag string) ([]ResolvedService, error)

func (*ServiceDiscovery) GetValue

func (sd *ServiceDiscovery) GetValue(key string) ([]byte, error)

func (*ServiceDiscovery) PutValue

func (sd *ServiceDiscovery) PutValue(key string, value []byte) error

func (*ServiceDiscovery) SubscribeToKey

func (sd *ServiceDiscovery) SubscribeToKey(key string, valuechan chan []byte)

type ServiceRegistration

type ServiceRegistration struct {
	ServiceDiscoveryURL                 string
	ServiceDiscoveryUsername            string
	ServiceDiscoveryPassword            string
	ServiceDiscoveryHealthPingIntervall time.Duration

	MicroserviceID       string
	MicroserviceName     string
	MicroserviceTags     []string
	MicroserviceMetadata map[string]string
	MicroserviceURL      string
}

ServiceRegistration used for register service in service discovery.

Jump to

Keyboard shortcuts

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