nats

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNatsConfig = errors.New("secret does not contain a valid nats configuration")
)

Functions

func ConsumerInfo

func ConsumerInfo(c *Client, domain string, consumer string, stream string) (*nats.ConsumerInfo, error)

ConsumerInfo returns the consumer info for a given consumer name for a given domain and stream

func ConsumerList

func ConsumerList(c *Client, domain string, stream string) ([]string, error)

ConsumerList returns a list of consumer names for a given domain

func GetPublicKeys

func GetPublicKeys(jwt string) (string, string, error)

func StreamInfo

func StreamInfo(c *Client, domain string, stream string) (*nats.StreamInfo, error)

StreamInfo returns the stream info for a given stream name for a given domain

func StreamList

func StreamList(c *Client, domain string) ([]string, error)

StreamList returns a list of stream names for a given domain

Types

type Client

type Client struct {
	Address          string
	UserPublicKey    string
	AccountPublicKey string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(creds []byte) (*Client, error)

func (*Client) CreateConsumer

func (c *Client) CreateConsumer(domain string, stream string, config *nats.ConsumerConfig) error

CreateConsumer creates a new jetstream consumer with a given configuration for a given domain and stream

func (*Client) CreateStream

func (c *Client) CreateStream(domain string, config *nats.StreamConfig) error

CreateStream creates a new jetstream stream with a given configuration for a given domain

func (*Client) DeleteConsumer

func (c *Client) DeleteConsumer(domain string, stream string, consumer string) error

DeleteConsumer deletes a jetstream consumer with a given name for a given domain and stream

func (*Client) DeleteStream

func (c *Client) DeleteStream(domain string, name string) error

DeleteStream deletes a jetstream stream with a given name for a given domain

func (*Client) Disconnect

func (c *Client) Disconnect()

func (*Client) UpdateConsumer

func (c *Client) UpdateConsumer(domain string, stream string, config *nats.ConsumerConfig) error

UpdateConsumer updates a jetstream consumer with a given configuration for a given domain and stream

func (*Client) UpdateStream

func (c *Client) UpdateStream(domain string, config *nats.StreamConfig) error

UpdateStream updates a jetstream stream with a given configuration for a given domain

type Config

type Config struct {
	// JWT is the NATS users JWT token to use for authentication.
	JWT string `json:"jwt"`
	// SeedKey is the NATS users seed key to use for authentication.
	SeedKey string `json:"seed_key"`
	// Address is the NATS address to use for authentication.
	Address string `json:"address"`
}

Jump to

Keyboard shortcuts

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