raw

package
v2.46.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JetStream added in v2.44.0

func JetStream(ctx context.Context, name string, cfg Config) (jetstream.JetStream, error)

Types

type Config

type Config struct {
	Endpoint             string        `mapstructure:"address"`          // Endpoint of the nats server
	Cluster              string        `mapstructure:"clusterID"`        // CluserID of the nats cluster
	TLSInsecure          bool          `mapstructure:"tls-insecure"`     // Whether to verify TLS certificates
	TLSRootCACertificate string        `mapstructure:"tls-root-ca-cert"` // The root CA certificate used to validate the TLS certificate
	EnableTLS            bool          `mapstructure:"enable-tls"`       // Enable TLS
	AuthUsername         string        `mapstructure:"username"`         // Username for authentication
	AuthPassword         string        `mapstructure:"password"`         // Password for authentication
	MaxAckPending        int           `mapstructure:"max-ack-pending"`  // Maximum number of unacknowledged messages
	AckWait              time.Duration `mapstructure:"ack-wait"`         // Time to wait for an ack
}

Config is the configuration needed for a NATS event stream

type Event

type Event struct {
	events.Event
	// contains filtered or unexported fields
}

func (*Event) Ack

func (re *Event) Ack() error

func (*Event) InProgress

func (re *Event) InProgress() error

type RawEvent

type RawEvent struct {
	Timestamp time.Time
	Metadata  map[string]string
	ID        string
	Topic     string
	Payload   []byte
	// contains filtered or unexported fields
}

type RawStream

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

func (*RawStream) Consume

func (s *RawStream) Consume(group string, evs ...events.Unmarshaller) (<-chan Event, error)

func (*RawStream) JetStream

func (s *RawStream) JetStream() jetstream.Stream

type Stream

type Stream interface {
	Consume(group string, evs ...events.Unmarshaller) (<-chan Event, error)
	JetStream() jetstream.Stream
}

func FromConfig

func FromConfig(ctx context.Context, name string, cfg Config) (Stream, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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