consul

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalCommandMeta

func MarshalCommandMeta(data []CommandMeta) (string, error)

Types

type CommandMeta

type CommandMeta struct {
	Command string `json:"command" validate:"required"`
	Queue   string `json:"queue" validate:"required"`
}

type CommandMetaInfo

type CommandMetaInfo []CommandMeta

func ParseCommandMeta

func ParseCommandMeta(data []byte) (*CommandMetaInfo, error)

type ConsulDiscovery

type ConsulDiscovery struct {
	// contains filtered or unexported fields
}

func NewConsulClient

func NewConsulClient(address string) (*ConsulDiscovery, error)

NewConsulClient create new Consul consul client

func (*ConsulDiscovery) Close

func (d *ConsulDiscovery) Close() error

func (*ConsulDiscovery) Deregister

func (d *ConsulDiscovery) Deregister(id string) error

Deregister service by ID

func (*ConsulDiscovery) DiscoverByMeta

func (d *ConsulDiscovery) DiscoverByMeta(key, value string) ([]Service, error)

DiscoverByMeta discover services by specified meta

func (*ConsulDiscovery) DiscoverByName

func (d *ConsulDiscovery) DiscoverByName(name string) ([]Service, error)

DiscoverByName discover service by name

func (*ConsulDiscovery) DiscoverByTag

func (d *ConsulDiscovery) DiscoverByTag(tag string) ([]Service, error)

DiscoverByTag discover services by tag

func (*ConsulDiscovery) DiscoverFilter

func (d *ConsulDiscovery) DiscoverFilter(filter string) ([]Service, error)

DiscoverFilter discover service by specified filter

func (*ConsulDiscovery) Register

func (d *ConsulDiscovery) Register(id, name string, host string, port int, meta map[string]string) error

Register new service

type Service

type Service struct {
	ID   uuid.UUID         `json:"id"`
	Name string            `json:"name"`
	Tags []string          `json:"tags"`
	Meta map[string]string `json:"meta"`
}

Jump to

Keyboard shortcuts

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