Documentation ¶
Overview ¶
Package natssrv provides the HTTP server and NATS subscribers
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEventMissingGroupID = errors.New("event missing group ID")
ErrEventMissingGroupID is returned when a group event is missing the group ID
Functions ¶
This section is empty.
Types ¶
type NATSClient ¶
type NATSClient struct {
// contains filtered or unexported fields
}
NATSClient is a NATS client with some configuration
func NewNATSClient ¶
func NewNATSClient(opts ...NATSOption) (*NATSClient, error)
NewNATSClient configures and establishes a new NATS client connection
type NATSOption ¶
type NATSOption func(c *NATSClient)
NATSOption is a functional configuration option for NATS
func WithNATSConn ¶
func WithNATSConn(nc *nats.Conn) NATSOption
WithNATSConn sets the nats connection
func WithNATSLogger ¶
func WithNATSLogger(l *zap.Logger) NATSOption
WithNATSLogger sets the NATS client logger
func WithNATSPrefix ¶
func WithNATSPrefix(p string) NATSOption
WithNATSPrefix sets the nats subscription prefix
func WithNATSQueueGroup ¶
func WithNATSQueueGroup(q string, s int) NATSOption
WithNATSQueueGroup sets the nats subscription queue group
func WithNATSSubject ¶
func WithNATSSubject(s string) NATSOption
WithNATSSubject sets the nats subscription subject
type Server ¶
type Server struct { Logger *zap.Logger Listen string Debug bool AuditFileWriter io.Writer NATSClient *NATSClient Reconciler *reconciler.Reconciler }
Server implements the HTTP Server
func (*Server) ApplicationsMessageHandler ¶
func (s *Server) ApplicationsMessageHandler(m *nats.Msg)
ApplicationsMessageHandler handles messages for governor applications events (linking/unlinking a group)
func (*Server) MembersMessageHandler ¶
func (s *Server) MembersMessageHandler(m *nats.Msg)
MembersMessageHandler handles messages for governor members events (adding/removing members)