nats

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDataServiceListener added in v1.0.1

func NewDataServiceListener[T any](options DataServiceListenerOptions[T]) (services.Service, error)

Types

type Connection

type Connection struct {
	ConnectionOptions
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(options ConnectionOptions) (*Connection, error)

func (*Connection) Close

func (c *Connection) Close()

func (*Connection) IsConnected

func (c *Connection) IsConnected() bool

func (*Connection) Subscribe

func (c *Connection) Subscribe(ctx context.Context, options SubscriptionOptions) error

type ConnectionOptions

type ConnectionOptions struct {
	Endpoint            string
	Name                string
	Logger              *zap.SugaredLogger
	CredentialsFilePath string
	Registerer          prometheus.Registerer
}

type DataServiceListener added in v1.0.1

type DataServiceListener[T any] struct {
	// contains filtered or unexported fields
}

func (*DataServiceListener[T]) Name added in v1.0.1

func (d *DataServiceListener[T]) Name() string

func (*DataServiceListener[T]) Start added in v1.0.1

func (d *DataServiceListener[T]) Start() <-chan error

func (*DataServiceListener[T]) Stop added in v1.0.1

func (d *DataServiceListener[T]) Stop()

type DataServiceListenerOptions added in v1.0.1

type DataServiceListenerOptions[T any] struct {
	Name        string
	Kind        string
	Handler     func(t events.DataServiceEvent[T]) error
	BufferSize  int
	WorkerCount int
	Connection  *Connection
}

func (DataServiceListenerOptions[T]) Validate added in v1.0.1

func (t DataServiceListenerOptions[T]) Validate() error

type EventDisposition

type EventDisposition string
const (
	EventDispositionAccepted EventDisposition = "accepted"
	EventDispositionErrored  EventDisposition = "errored"
	EventDispositionIgnored  EventDisposition = "ignored"
)

type MessageHandler

type MessageHandler func(msg *Msg) (EventDisposition, error)

type Msg

type Msg = nats.Msg

type SubscriptionOptions

type SubscriptionOptions struct {
	Name        string
	Topic       string
	Group       string
	Handler     MessageHandler
	BufferSize  int
	WorkerCount int
}

Jump to

Keyboard shortcuts

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