natssrv

package
v0.0.0-...-110cbc6 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package natssrv provides the HTTP server and NATS subscribers

Index

Constants

This section is empty.

Variables

View Source
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)

func (*Server) NewServer

func (s *Server) NewServer() *http.Server

NewServer returns a configured server

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run will start the server listening on the specified address

Jump to

Keyboard shortcuts

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