enats

package
v0.4.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const EventStreamPrefix = "ev."

Variables

This section is empty.

Functions

func ToConsumerQueueName

func ToConsumerQueueName(pfx, topic string) string

Given a user-specified topic, return the queue name to use for NATS consumers.

func ToSubject added in v0.3.2

func ToSubject(topic string) string

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

func ToTopic

func ToTopic(subject string) string

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, ResultKV 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) 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