mbus

package
v0.0.0-...-724ac05 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0, BSD-2-Clause-Views, BSD-3-Clause, + 1 more Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 {
	Host                    string            `json:"host"`
	Port                    uint16            `json:"port"`
	Protocol                string            `json:"protocol"`
	TLSPort                 uint16            `json:"tls_port"`
	Uris                    []route.Uri       `json:"uris"`
	Tags                    map[string]string `json:"tags"`
	App                     string            `json:"app"`
	StaleThresholdInSeconds int               `json:"stale_threshold_in_seconds"`
	RouteServiceURL         string            `json:"route_service_url"`
	PrivateInstanceID       string            `json:"private_instance_id"`
	ServerCertDomainSAN     string            `json:"server_cert_domain_san"`
	PrivateInstanceIndex    string            `json:"private_instance_index"`
	IsolationSegment        string            `json:"isolation_segment"`
	EndpointUpdatedAtNs     int64             `json:"endpoint_updated_at_ns"`
}

RegistryMessage defines the format of a route registration/unregistration easyjson:json

func (RegistryMessage) MarshalEasyJSON

func (v RegistryMessage) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (RegistryMessage) MarshalJSON

func (v RegistryMessage) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*RegistryMessage) UnmarshalEasyJSON

func (v *RegistryMessage) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*RegistryMessage) UnmarshalJSON

func (v *RegistryMessage) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

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) MarshalEasyJSON

func (v Subscriber) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Subscriber) MarshalJSON

func (v Subscriber) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

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

func (*Subscriber) UnmarshalEasyJSON

func (v *Subscriber) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Subscriber) UnmarshalJSON

func (v *Subscriber) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

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