nats

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NatsConnection

type NatsConnection struct {
	HostName     string
	Port         string
	UseJetstream bool

	Conn *nats.Conn
	JS   jetstream.JetStream
	// contains filtered or unexported fields
}

func DefaultNatsConnection

func DefaultNatsConnection() *NatsConnection

func (*NatsConnection) Close

func (n *NatsConnection) Close()

func (*NatsConnection) Connect

func (n *NatsConnection) Connect() error

func (*NatsConnection) GenericCommandSubscriber added in v0.13.2

func (n *NatsConnection) GenericCommandSubscriber(logger *slog.Logger, commandName string, handler func([]byte) error)

func (*NatsConnection) GenericNfcSubscriber added in v0.13.2

func (n *NatsConnection) GenericNfcSubscriber(logger *slog.Logger, tagId string, handler func([]byte) error)

func (*NatsConnection) GenericScheduleSubscriber added in v0.13.2

func (n *NatsConnection) GenericScheduleSubscriber(logger *slog.Logger, scheduleName string, handler func() error)

func (*NatsConnection) GenericStateSubscriber added in v0.13.2

func (n *NatsConnection) GenericStateSubscriber(logger *slog.Logger, entityId string, handler func(ha.StateData) error)

func (*NatsConnection) GenericTimerSubscriber added in v0.16.1

func (n *NatsConnection) GenericTimerSubscriber(logger *slog.Logger, timerName string, handler func() error)

func (*NatsConnection) GenericZhaSubscriber added in v0.13.2

func (n *NatsConnection) GenericZhaSubscriber(logger *slog.Logger, deviceIeee string, handler func(ha.EventData) error)

func (*NatsConnection) GenericZwaveLSubscriber added in v0.13.2

func (n *NatsConnection) GenericZwaveLSubscriber(logger *slog.Logger, deviceId string, scene bool, handler func(ha.EventData) error)

func (*NatsConnection) Publish

func (n *NatsConnection) Publish(ctx context.Context, subject string, payload []byte, opts ...jetstream.PublishOpt)

func (*NatsConnection) Stream

func (n *NatsConnection) Stream(ctx context.Context, subject string) (stream jetstream.Stream, consumer jetstream.Consumer, err error)

func (*NatsConnection) Subscribe

func (n *NatsConnection) Subscribe(subject string) (sub *nats.Subscription, ch chan *nats.Msg, err error)

func (*NatsConnection) WithConnectionOption

func (n *NatsConnection) WithConnectionOption(opt nats.Option) *NatsConnection

func (*NatsConnection) WithHostName

func (n *NatsConnection) WithHostName(hostname string) *NatsConnection

func (*NatsConnection) WithJetstream

func (n *NatsConnection) WithJetstream(jetstream bool) *NatsConnection

func (*NatsConnection) WithJetstreamOption

func (n *NatsConnection) WithJetstreamOption(opt jetstream.JetStreamOpt) *NatsConnection

func (*NatsConnection) WithPort

func (n *NatsConnection) WithPort(port string) *NatsConnection

Jump to

Keyboard shortcuts

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