jetstream

package
v1.1.70 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: AGPL-3.0 Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	UserID        = "user_id"
	RoomID        = "room_id"
	EventID       = "event_id"
	RoomEventType = "output_room_event_type"
)

Variables

View Source
var (
	InputRoomEvent          = "InputRoomEvent"
	InputDeviceListUpdate   = "InputDeviceListUpdate"
	InputSigningKeyUpdate   = "InputSigningKeyUpdate"
	OutputRoomEvent         = "OutputRoomEvent"
	OutputAppserviceEvent   = "OutputAppserviceEvent"
	OutputSendToDeviceEvent = "OutputSendToDeviceEvent"
	OutputKeyChangeEvent    = "OutputKeyChangeEvent"
	OutputTypingEvent       = "OutputTypingEvent"
	OutputClientData        = "OutputClientData"
	OutputNotificationData  = "OutputNotificationData"
	OutputReceiptEvent      = "OutputReceiptEvent"
	OutputStreamEvent       = "OutputStreamEvent"
	OutputReadUpdate        = "OutputReadUpdate"
	RequestPresence         = "GetPresence"
	OutputPresenceEvent     = "OutputPresenceEvent"
	InputFulltextReindex    = "InputFulltextReindex"
)

Functions

func DeleteAllStreams

func DeleteAllStreams(js natsclient.JetStreamContext, cfg *config.JetStream)

func InputRoomEventSubj

func InputRoomEventSubj(roomID string) string

func JetStreamConsumer

func JetStreamConsumer(
	ctx context.Context, js nats.JetStreamContext, subj, durable string, batch int,
	f func(ctx context.Context, msgs []*nats.Msg) bool,
	opts ...nats.SubOpt,
) error

JetStreamConsumer starts a durable consumer on the given subject with the given durable name. The function will be called when one or more messages is available, up to the maximum batch size specified. If the batch is set to 1 then messages will be delivered one at a time. If the function is called, the messages array is guaranteed to be at least 1 in size. Any provided NATS options will be passed through to the pull subscriber creation. The consumer will continue to run until the context expires, at which point it will stop.

func JetStreamConsumerWithNakDelay added in v1.0.4

func JetStreamConsumerWithNakDelay(
	ctx context.Context, js nats.JetStreamContext, subj, durable string, batch int,
	f func(ctx context.Context, msgs []*nats.Msg) bool,
	nakDelay func(msg *nats.Msg) time.Duration,
	opts ...nats.SubOpt,
) error

JetStreamConsumerWithNakDelay behaves like JetStreamConsumer, but negative acknowledgements use the per-message delay returned by nakDelay. This keeps transient downstream failures from causing immediate redelivery loops.

func Tokenise

func Tokenise(str string) string

Types

type LogAdapter

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

func NewLogAdapter

func NewLogAdapter() *LogAdapter

func (*LogAdapter) Debugf

func (l *LogAdapter) Debugf(format string, v ...interface{})

func (*LogAdapter) Errorf

func (l *LogAdapter) Errorf(format string, v ...interface{})

func (*LogAdapter) Fatalf

func (l *LogAdapter) Fatalf(format string, v ...interface{})

func (*LogAdapter) Noticef

func (l *LogAdapter) Noticef(format string, v ...interface{})

func (*LogAdapter) Tracef

func (l *LogAdapter) Tracef(format string, v ...interface{})

func (*LogAdapter) Warnf

func (l *LogAdapter) Warnf(format string, v ...interface{})

type NATSInstance

type NATSInstance struct {
	*natsserver.Server
	// contains filtered or unexported fields
}

func (*NATSInstance) Prepare

Jump to

Keyboard shortcuts

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