Documentation
¶
Index ¶
- func WithoutJetstream(nc *NatsConnection)
- type NatsConnection
- func (n *NatsConnection) Close()
- func (n *NatsConnection) Connect() error
- func (n *NatsConnection) GenericCommandSubscriber(logger *slog.Logger, commandName string, handler func([]byte) error)
- func (n *NatsConnection) GenericNfcSubscriber(logger *slog.Logger, tagId string, handler func([]byte) error)
- func (n *NatsConnection) GenericScheduleSubscriber(logger *slog.Logger, scheduleName string, handler func() error)
- func (n *NatsConnection) GenericStateSubscriber(logger *slog.Logger, entityId string, handler func(ha.StateData) error)
- func (n *NatsConnection) GenericTimerSubscriber(logger *slog.Logger, timerName string, handler func() error)
- func (n *NatsConnection) GenericZhaSubscriber(logger *slog.Logger, deviceIeee string, handler func(ha.EventData) error)
- func (n *NatsConnection) GenericZwaveLSubscriber(logger *slog.Logger, deviceId string, scene bool, ...)
- func (n *NatsConnection) Publish(ctx context.Context, subject string, payload []byte, ...)
- func (n *NatsConnection) Stream(ctx context.Context, subject string) (stream jetstream.Stream, consumer jetstream.Consumer, err error)
- func (n *NatsConnection) Subscribe(subject string) (sub *nats.Subscription, ch chan *nats.Msg, err error)
- type NatsConnectionOption
- func WithClientName(name string) NatsConnectionOption
- func WithConnectionOption(opt nats.Option) NatsConnectionOption
- func WithHostName(hostname string) NatsConnectionOption
- func WithJetstreamnOption(opt jetstream.JetStreamOpt) NatsConnectionOption
- func WithPort(port string) NatsConnectionOption
- func WithToken(token string) NatsConnectionOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithoutJetstream ¶ added in v0.21.0
func WithoutJetstream(nc *NatsConnection)
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 New ¶ added in v0.21.0
func New(optFuncs ...NatsConnectionOption) *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 (*NatsConnection) GenericNfcSubscriber ¶ added in v0.13.2
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 (*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 (*NatsConnection) GenericZwaveLSubscriber ¶ added in v0.13.2
func (*NatsConnection) Publish ¶
func (n *NatsConnection) Publish(ctx context.Context, subject string, payload []byte, opts ...jetstream.PublishOpt)
func (*NatsConnection) Subscribe ¶
func (n *NatsConnection) Subscribe(subject string) (sub *nats.Subscription, ch chan *nats.Msg, err error)
type NatsConnectionOption ¶ added in v0.21.0
type NatsConnectionOption func(*NatsConnection)
func WithClientName ¶ added in v0.21.0
func WithClientName(name string) NatsConnectionOption
func WithConnectionOption ¶ added in v0.21.0
func WithConnectionOption(opt nats.Option) NatsConnectionOption
func WithHostName ¶ added in v0.21.0
func WithHostName(hostname string) NatsConnectionOption
func WithJetstreamnOption ¶ added in v0.21.0
func WithJetstreamnOption(opt jetstream.JetStreamOpt) NatsConnectionOption
func WithPort ¶ added in v0.21.0
func WithPort(port string) NatsConnectionOption
func WithToken ¶ added in v0.21.0
func WithToken(token string) NatsConnectionOption
Click to show internal directories.
Click to hide internal directories.