nats

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Nats

type Nats struct {
	// contains filtered or unexported fields
}

Nats is a struct for a nats stream provider

func NewNats

func NewNats(client *nats.Conn) *Nats

NewNats returns a new nats stream provider

func (*Nats) AsyncSubscribe

func (n *Nats) AsyncSubscribe(ctx context.Context, topic, consumer string, handler providers.MessageHandler) error

AsyncSubscribe subscribes to a topic and calls the handler in a goroutine

func (*Nats) Publish

func (n *Nats) Publish(ctx context.Context, topic string, message map[string]any) error

Publish publishes a message to a topic

func (*Nats) Subscribe

func (n *Nats) Subscribe(ctx context.Context, topic, consumer string, handler providers.MessageHandler) error

Subscribe subscribes to a topic

Jump to

Keyboard shortcuts

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