nats

package
v0.0.0-...-0451d2a Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(url string) (*nats.Conn, error)

func NewJetStreamContext

func NewJetStreamContext(nc *nats.Conn, streams []nats.StreamConfig) (nats.JetStreamContext, error)

func NewStreams

func NewStreams(streams ...nats.StreamConfig) []nats.StreamConfig

Types

type ConsumerOption

type ConsumerOption func(*ConsumerOptions)

func WithBindStream

func WithBindStream(stream string) ConsumerOption

func WithCloseOnDone

func WithCloseOnDone() ConsumerOption

func WithDurable

func WithDurable(durable string) ConsumerOption

func WithMaxWait

func WithMaxWait(d time.Duration) ConsumerOption

WithMaxWait specifies the maximum amount of time the consumer will wait for a message to arrive before returning.

func WithMustHaveHandler

func WithMustHaveHandler(must bool) ConsumerOption

WithMustHaveHandler specifies whether the consumer must have a handler for every message it receives.

type ConsumerOptions

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

type EventsConsumer

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

func NewEventsConsumer

func NewEventsConsumer(nc *nats.Conn, handlers pubsub.Handlers, logger *zerolog.Logger, opts ...ConsumerOption) (*EventsConsumer, error)

func (*EventsConsumer) Consume

func (c *EventsConsumer) Consume(ctx context.Context, topic string) error

type EventsPublisher

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

func NewEventsPublisher

func NewEventsPublisher(nc *nats.Conn) *EventsPublisher

func (*EventsPublisher) Publish

func (p *EventsPublisher) Publish(ctx context.Context, events []pubsub.Event) error

type PersistentStreamConsumer

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

func NewPersistentStreamConsumer

func NewPersistentStreamConsumer(nc nats.JetStreamContext, handlers pubsub.Handlers, logger *zerolog.Logger, opts ...ConsumerOption) (*PersistentStreamConsumer, error)

func (*PersistentStreamConsumer) Consume

func (c *PersistentStreamConsumer) Consume(ctx context.Context, subject string) error

type StreamPublisher

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

func NewStreamPublisher

func NewStreamPublisher(nc nats.JetStreamContext, stream string) *StreamPublisher

func (*StreamPublisher) Publish

func (p *StreamPublisher) Publish(ctx context.Context, events []pubsub.Event) error

Jump to

Keyboard shortcuts

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