mq

package
v0.0.0-...-b11ff8e Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT 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 creates and manages the nats message queue connection

func (*Nats) Connect

func (n *Nats) Connect() error

Connect to the nats server

func (*Nats) Disconnect

func (n *Nats) Disconnect()

Disconnect from the nats server

func (*Nats) GetConfig

func (n *Nats) GetConfig() NatsConfig

GetConfig get the nats config

func (*Nats) GetConn

func (n *Nats) GetConn() *nats.Conn

GetConn retrieves the raw nats connection

func (*Nats) Init

func (n *Nats) Init() (*Nats, error)

Init create a new nats manager with a given config

func (*Nats) SendMessage

func (n *Nats) SendMessage(subject string, data any) error

SendMessage sends a request and captures the error

func (*Nats) SendRequest

func (n *Nats) SendRequest(subject string, data any, result any) error

SendRequest sends a request and captures the error

type NatsConfig

type NatsConfig struct {
	Host string
	User string
	Pass string
}

NatsConfig configuration structure for the nats mq

func (*NatsConfig) FromEnv

func (n *NatsConfig) FromEnv() (*NatsConfig, error)

FromEnv creates a nats config using environmental variables

func (*NatsConfig) IsSet

func (n *NatsConfig) IsSet() bool

IsSet checks if the configuration has been set Note: All fields required

Jump to

Keyboard shortcuts

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