nats

package
v0.0.0-...-9cb16bd Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package nats is a module for nats

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NatsContext

type NatsContext interface {
	// GetConn returns the nats connection
	GetConn() *nats.Conn

	// GetJetStreamContext returns the nats jetstream context
	GetJetStreamContext() nats.JetStreamContext

	// CreateStream creates a new stream
	CreateStream(streamName string, subject string) error

	// Subscribe subscribes to a stream
	Subscribe(subject string, handler func(msg *nats.Msg) error) error
}

func NewNats

func NewNats(opts ...Option) (NatsContext, error)

NewNats creates a new nats connection

type NatsOptions

type NatsOptions struct {
	URL string
}

NatsOptions defines the NATS configuration

type Option

type Option func(*NatsOptions)

Option is the func interface to assign options

func WithNatsURL

func WithNatsURL(url string) Option

WithNatsURL defines the NATS URL

Directories

Path Synopsis
Package nats_mock is a generated GoMock package.
Package nats_mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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