jetstream

package
v0.0.0-...-5cf3e1d Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSStoreFailedCode = 10077
)

Variables

View Source
var (
	ErrNotConnected        = common.BackendPublishError{HTTPCode: http.StatusBadGateway, Info: "no connection to NATS JetStream server"}
	ErrCannotSendToStream  = common.BackendPublishError{HTTPCode: http.StatusGatewayTimeout, Info: "cannot send to stream"}
	ErrNoSpaceLeftOnDevice = common.BackendPublishError{HTTPCode: http.StatusInsufficientStorage, Info: "insufficient resources on target stream"}
)

Functions

This section is empty.

Types

type Sender

type Sender struct {
	// contains filtered or unexported fields
}

Sender is responsible for sending messages over HTTP.

func NewSender

func NewSender(ctx context.Context, connection *nats.Conn, envCfg *env.NATSConfig, opts *options.Options, logger *logger.Logger) *Sender

NewSender returns a new NewSender instance with the given NATS connection.

func (*Sender) ConnectionStatus

func (s *Sender) ConnectionStatus() nats.Status

ConnectionStatus returns nats.code for the NATS connection used by the Sender.

func (*Sender) LivenessCheck

func (s *Sender) LivenessCheck(w http.ResponseWriter, _ *http.Request)

func (*Sender) ReadinessCheck

func (s *Sender) ReadinessCheck(w http.ResponseWriter, _ *http.Request)

ReadinessCheck returns an instance of http.HandlerFunc that checks the readiness of the given NATS Handler. It checks the NATS server connection status and reports 2XX if connected, otherwise reports 5XX. It panics if the given NATS Handler is nil.

func (*Sender) Send

func (s *Sender) Send(_ context.Context, event *event.Event) sender.PublishError

Send dispatches the event to the NATS backend in JetStream mode. If the NATS connection is not open, it returns an error.

func (*Sender) URL

func (s *Sender) URL() string

Jump to

Keyboard shortcuts

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