nats

package
v0.0.35 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNats

func NewNats(log logger.Logger, name string, hosts string, credentials gnats.Option, opts ...gnats.Option) (*gnats.Conn, error)

NewNats will return a new nats connections

Types

type EphemeralOptsFunc added in v0.0.27

type EphemeralOptsFunc func(config *ephemeralConsumerConfig) error

func WithEphemeralAckWait added in v0.0.28

func WithEphemeralAckWait(duration time.Duration) EphemeralOptsFunc

WithEphemeralAckWait overrides the default ack wait of 30s

func WithEphemeralConsumerDescription added in v0.0.27

func WithEphemeralConsumerDescription(description string) EphemeralOptsFunc

WithEphemeralConsumerDescription set the consumer description

func WithEphemeralContext added in v0.0.27

func WithEphemeralContext(context context.Context) EphemeralOptsFunc

WithEphemeralContext set the internal context

func WithEphemeralDelivery added in v0.0.27

func WithEphemeralDelivery(policy nats.DeliverPolicy) EphemeralOptsFunc

WithEphemeralDelivery set the internal context

func WithEphemeralDisableSubscriberLogging added in v0.0.34

func WithEphemeralDisableSubscriberLogging() EphemeralOptsFunc

WithEphemeralDisableSubscriberLogging to turn off extra trace logging in the subscriber

func WithEphemeralMaxAckPending added in v0.0.27

func WithEphemeralMaxAckPending(max int) EphemeralOptsFunc

WithEphemeralMaxAckPending set the maximum ack pending value

func WithEphemeralMaxDeliver added in v0.0.27

func WithEphemeralMaxDeliver(max int) EphemeralOptsFunc

WithEphemeralMaxDeliver set the maximum deliver value

type ExactlyOnceOptsFunc added in v0.0.27

type ExactlyOnceOptsFunc func(config *exactlyOnceConsumerConfig) error

func WithExactlyOnceConsumerDescription added in v0.0.27

func WithExactlyOnceConsumerDescription(description string) ExactlyOnceOptsFunc

WithExactlyOnceConsumerDescription set the consumer description

func WithExactlyOnceContext added in v0.0.27

func WithExactlyOnceContext(context context.Context) ExactlyOnceOptsFunc

WithExactlyOnceContext set the internal context

func WithExactlyOnceDelivery added in v0.0.27

func WithExactlyOnceDelivery(policy nats.DeliverPolicy) ExactlyOnceOptsFunc

WithExactlyOnceDelivery set the internal context

func WithExactlyOnceDisableSubscriberLogging added in v0.0.34

func WithExactlyOnceDisableSubscriberLogging() ExactlyOnceOptsFunc

WithExactlyOnceDisableSubscriberLogging to turn off extra trace logging in the subscriber

func WithExactlyOnceMaxDeliver added in v0.0.27

func WithExactlyOnceMaxDeliver(max int) ExactlyOnceOptsFunc

WithExactlyOnceMaxDeliver set the maximum deliver value

func WithExactlyOnceReplicas added in v0.0.32

func WithExactlyOnceReplicas(replicas int) ExactlyOnceOptsFunc

WithExactlyOnceReplicas set the number of replicas for the consumer

type Handler added in v0.0.22

type Handler func(ctx context.Context, payload []byte, msg *nats.Msg) error

type QueueOptsFunc added in v0.0.27

type QueueOptsFunc func(config *queueConsumerConfig) error

func WithQueueConsumerDescription added in v0.0.27

func WithQueueConsumerDescription(description string) QueueOptsFunc

WithQueueConsumerDescription set the consumer description

func WithQueueContext added in v0.0.27

func WithQueueContext(context context.Context) QueueOptsFunc

WithQueueContext set the internal context

func WithQueueDelivery added in v0.0.27

func WithQueueDelivery(policy nats.DeliverPolicy) QueueOptsFunc

WithQueueDelivery set the internal context

func WithQueueDisableSubscriberLogging added in v0.0.34

func WithQueueDisableSubscriberLogging() QueueOptsFunc

WithQueueDisableSubscriberLogging to turn off extra trace logging in the subscriber

func WithQueueMaxAckPending added in v0.0.27

func WithQueueMaxAckPending(max int) QueueOptsFunc

WithQueueMaxAckPending set the maximum ack pending value

func WithQueueMaxDeliver added in v0.0.27

func WithQueueMaxDeliver(max int) QueueOptsFunc

WithQueueMaxDeliver set the maximum deliver value

func WithQueueReplicas added in v0.0.32

func WithQueueReplicas(replicas int) QueueOptsFunc

WithQueueReplicas set the number of replicas

type Subscriber added in v0.0.22

type Subscriber interface {
	// Close the subscriber and stop delivery
	Close() error
}

Subscriber represents a nats subscriber

func NewEphemeralConsumer added in v0.0.23

func NewEphemeralConsumer(logger logger.Logger, js nats.JetStreamContext, stream string, subject string, handler Handler, opts ...EphemeralOptsFunc) (Subscriber, error)

NewEphemeralConsumer will create (or reuse) an ephemeral consumer

func NewExactlyOnceConsumer added in v0.0.3

func NewExactlyOnceConsumer(logger logger.Logger, js nats.JetStreamContext, stream string, durable string, subject string, handler Handler, opts ...ExactlyOnceOptsFunc) (Subscriber, error)

NewExactlyOnceConsumer will create (or reuse) an exactly once durable consumer

func NewQueueConsumer added in v0.0.22

func NewQueueConsumer(logger logger.Logger, js nats.JetStreamContext, stream string, durable string, subject string, handler Handler, opts ...QueueOptsFunc) (Subscriber, error)

NewQueueConsumer will create (or reuse) a queue consumer with default config

Jump to

Keyboard shortcuts

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