Documentation
¶
Index ¶
- func Connect(c *config.Config, reconnected chan<- Signal, l logger.Logger) *nats.Conn
- type Client
- type RegistryMessage
- type Signal
- type Subscriber
- func (s *Subscriber) Dropped() (int, error)
- func (v Subscriber) MarshalEasyJSON(w *jwriter.Writer)
- func (v Subscriber) MarshalJSON() ([]byte, error)
- func (s *Subscriber) Pending() (int, error)
- func (s *Subscriber) Run(signals <-chan os.Signal, ready chan<- struct{}) error
- func (v *Subscriber) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Subscriber) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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"`
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 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