Documentation
¶
Index ¶
- func ConsumePull[T any](ctx context.Context, js nats.JetStreamContext, cfg ConsumerConfig, ...) error
- func ConsumePush[T any](ctx context.Context, js nats.JetStreamContext, cfg ConsumerConfig, ...) error
- func WaitForNATS(ctx context.Context, url string, retries int, delay time.Duration) error
- type AckAction
- type Cache
- type Conn
- type ConnOptions
- type ConsumerConfig
- type Handler
- type KVConfig
- type Msg
- type Producer
- type StreamConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConsumePull ¶
func ConsumePull[T any](ctx context.Context, js nats.JetStreamContext, cfg ConsumerConfig, handler Handler[T]) error
func ConsumePush ¶
func ConsumePush[T any](ctx context.Context, js nats.JetStreamContext, cfg ConsumerConfig, handler Handler[T]) error
Types ¶
type Cache ¶
type Cache[T any] struct { // contains filtered or unexported fields }
type Conn ¶
type Conn struct {
NC *nats.Conn
JS nats.JetStreamContext
// contains filtered or unexported fields
}
func (*Conn) EnsureStream ¶
func (c *Conn) EnsureStream(cfg StreamConfig) error
func (*Conn) EnsureStreams ¶
func (c *Conn) EnsureStreams(configs ...StreamConfig) error
type ConnOptions ¶
type ConsumerConfig ¶
type ConsumerConfig struct {
Stream string
Subject string
Durable string
QueueGroup string
DeliverAll bool
MaxDeliver int
AckWait time.Duration
BackOff []time.Duration
PullBatch int
PullMaxWait time.Duration
NakDelay time.Duration
}
func DefaultConsumerConfig ¶
func DefaultConsumerConfig(stream, durable string) ConsumerConfig
type KVConfig ¶
type KVConfig struct {
Bucket string
Description string
TTL time.Duration
MaxBytes int64
Storage nats.StorageType
}
func DefaultKVConfig ¶
type Producer ¶
type Producer[T any] struct { // contains filtered or unexported fields }
func NewProducer ¶
func NewProducer[T any](js nats.JetStreamContext, subject string) *Producer[T]
type StreamConfig ¶
type StreamConfig struct {
Name string
Subjects []string
MaxAge time.Duration
MaxBytes int64
Storage nats.StorageType
Compression nats.StoreCompression
}
func DefaultStreamConfig ¶
func DefaultStreamConfig(name string) StreamConfig
Click to show internal directories.
Click to hide internal directories.