enats

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AnyCastMachineID = config.MachineID(0)

Functions

func ToConsumerQueueName

func ToConsumerQueueName(pfx, topic string) string

func ToConsumerSubjects

func ToConsumerSubjects(topic string) []string

Given a user-specified topic, return the subject names to use for NATS consumers.

func ToPublisherSubject

func ToPublisherSubject(topic string) string

Given a user-specified topic, return the subject name to use for NATS publishers.

func ToPublisherSubjectWithTarget

func ToPublisherSubjectWithTarget(topic string, target config.MachineID) string

func ToTopic

func ToTopic(subject string) (topic string, dest config.MachineID)

Given a nats subject, return the user-specified topic.

Types

type Client

type Client struct {
	*nats.Conn
	Jet jetstream.JetStream
}

func (*Client) Consumer

func (r *Client) Consumer(ctx context.Context, stream string, cfg jetstream.ConsumerConfig) (c jetstream.Consumer, err error)

func (*Client) KVStore

func (r *Client) KVStore(ctx context.Context, cfg jetstream.KeyValueConfig) (kv jetstream.KeyValue, err error)

Wrappers

func (*Client) Stream

func (r *Client) Stream(ctx context.Context, cfg jetstream.StreamConfig) (str jetstream.Stream, err error)

type Gateway

type Gateway struct {
	Client
	Server *autonats.Server

	// Internal resources
	PeerKV, SchedulerKV jetstream.KeyValue
	// Global resources for the user
	DefaultKV, DailyKV, WeeklyKV, MonthlyKV jetstream.KeyValue

	EventStream jetstream.Stream
	// contains filtered or unexported fields
}

func New

func New() (r *Gateway)

func (*Gateway) Close

func (r *Gateway) Close(ctx context.Context) (err error)

func (*Gateway) DefaultKVStore

func (r *Gateway) DefaultKVStore(key string) (kv jetstream.KeyValue)

Gets the KV store for the default kv usage given the key.

func (*Gateway) Open

func (r *Gateway) Open(ctx context.Context) (err error)

Jump to

Keyboard shortcuts

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