Documentation ¶
Index ¶
- func ToPayload(obj any) []byte
- type Consumer
- type ConsumerConfig
- type HookConfig
- type JetstreamConsumer
- type JetstreamConsumerConfig
- type NATSHook
- type NatsUtils
- func (natsUtils *NatsUtils) Close()
- func (natsUtils *NatsUtils) CreateConsumer(ctx context.Context, config ConsumerConfig) (*Consumer, error)
- func (natsUtils *NatsUtils) CreateKeyValue(ctx context.Context, config jetstream.KeyValueConfig) (jetstream.KeyValue, error)
- func (natsUtils *NatsUtils) Jetstream() jetstream.JetStream
- func (natsUtils *NatsUtils) Nats() *nats.Conn
- func (natsUtils *NatsUtils) PublishOnStream(ctx context.Context, stream, subject string, data []byte) (*jetstream.PubAck, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsumerConfig ¶
type ConsumerConfig struct { StreamName string // stream from which to consume ConsumerName string // consumer name Description string // consumer description FilterSubjects []string // subjects received by the consumer Durable bool // is a durable consumer InactiveThreshold time.Duration // used if durable is true only }
type HookConfig ¶
type JetstreamConsumer ¶
type JetstreamConsumer struct {
// contains filtered or unexported fields
}
func NewJetstreamConsumer ¶
func NewJetstreamConsumer(ctx context.Context, nc *nats.Conn, config JetstreamConsumerConfig) (*JetstreamConsumer, error)
func (*JetstreamConsumer) Fetch ¶
func (jetstreamConsumer *JetstreamConsumer) Fetch(batch int, maxWait time.Duration) (jetstream.MessageBatch, error)
Fetch returns a channel of messages
type JetstreamConsumerConfig ¶
type NATSHook ¶
type NATSHook struct {
// contains filtered or unexported fields
}
func NewNatsHook ¶
func NewNatsHook(config HookConfig) (*NATSHook, error)
type NatsUtils ¶
type NatsUtils struct { NatsConfig *cli.NatsConfig // contains filtered or unexported fields }
NatsUtils provices utilities for nats/jetstream operations
func NewFromConfig ¶
func NewFromConfig(config *cli.NatsConfig) (*NatsUtils, error)
NewFromConfig createx a NatsUtils for a cli.NatsConfig and connects to nats
func NewFromConnection ¶
NewFromConnection creates a NatsUtils from an existing nats connection
func (*NatsUtils) Close ¶
func (natsUtils *NatsUtils) Close()
Close closes the nats connection if established
func (*NatsUtils) CreateConsumer ¶
func (*NatsUtils) CreateKeyValue ¶
func (natsUtils *NatsUtils) CreateKeyValue(ctx context.Context, config jetstream.KeyValueConfig) (jetstream.KeyValue, error)
CreateKeyValue creates a key value store
Click to show internal directories.
Click to hide internal directories.