mbus

package
v0.0.0-...-96ff825 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0, BSD-2-Clause-Views, BSD-3-Clause, + 1 more Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(c *config.Config, reconnected chan<- Signal, l logger.Logger) *nats.Conn

Types

type Client

type Client interface {
	Subscribe(subj string, cb nats.MsgHandler) (*nats.Subscription, error)
	Publish(subj string, data []byte) error
}

type RegistryMessage

type RegistryMessage struct {
	App                     string            `json:"app"`
	AvailabilityZone        string            `json:"availability_zone"`
	EndpointUpdatedAtNs     int64             `json:"endpoint_updated_at_ns"`
	Host                    string            `json:"host"`
	IsolationSegment        string            `json:"isolation_segment"`
	Port                    uint16            `json:"port"`
	PrivateInstanceID       string            `json:"private_instance_id"`
	PrivateInstanceIndex    string            `json:"private_instance_index"`
	Protocol                string            `json:"protocol"`
	RouteServiceURL         string            `json:"route_service_url"`
	ServerCertDomainSAN     string            `json:"server_cert_domain_san"`
	StaleThresholdInSeconds int               `json:"stale_threshold_in_seconds"`
	TLSPort                 uint16            `json:"tls_port"`
	Tags                    map[string]string `json:"tags"`
	Uris                    []route.Uri       `json:"uris"`
}

func (*RegistryMessage) ValidateMessage

func (rm *RegistryMessage) ValidateMessage() bool

ValidateMessage checks to ensure the registry message is valid

type Signal

type Signal struct{}

type Subscriber

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

Subscriber subscribes to NATS for all router.* messages and handles them

func NewSubscriber

func NewSubscriber(
	mbusClient Client,
	routeRegistry registry.Registry,
	c *config.Config,
	reconnected <-chan Signal,
	l logger.Logger,
) *Subscriber

NewSubscriber returns a new Subscriber

func (*Subscriber) Dropped

func (s *Subscriber) Dropped() (int, error)

func (*Subscriber) Pending

func (s *Subscriber) Pending() (int, error)

func (*Subscriber) Run

func (s *Subscriber) Run(signals <-chan os.Signal, ready chan<- struct{}) error

Run manages the lifecycle of the subscriber process

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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