mq

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACKMode

type ACKMode uint32
const (
	ACK_AUTO ACKMode = iota
	ACK_MANUAL
)

type Consumer added in v0.13.2

type Consumer interface {
	OnMessage(ctx context.Context, message *Message) error
}

type ConsumerOptions

type ConsumerOptions struct {
	Topic                 string
	SubscriptionName      string
	SubscriptionType      SubscriptionType
	MessageListener       func(ctx context.Context, message *Message) error
	ACKMode               ACKMode
	RetryTimes            uint64
	MaxMessageChannelSize uint64
	NatsOpts              NatsOpts
	IsErrorPanic          bool
}

type IClient added in v0.5.0

type IClient interface {
	//sync
	Send(msg *Message) error
	SendAsync(msg *Message) error
	//async
	Subscribe(options ConsumerOptions) error
	SubscribeSync(options ConsumerOptions) error
	Close()
}

type Message added in v0.13.2

type Message struct {
	Topic           string
	Header          map[string]string
	Payload         []byte
	RedeliveryCount uint64
	DeliverAfter    time.Duration
	DeliverAt       time.Time
	NatsOpts        NatsOpts
	SubOpts         SubOpts
}

type NatsOpts added in v0.13.2

type NatsOpts struct {
	Stream        string
	PullBatchSize int
}

type SubOpts added in v0.13.9

type SubOpts struct {
	Name string
}

type SubscriptionType added in v0.5.0

type SubscriptionType int
const (

	// Exclusive there can be only 1 consumer on the same topic with the same subscription name
	Exclusive SubscriptionType = iota

	// Shared subscription mode, multiple consumer will be able to use the same subscription name
	// and the messages will be dispatched according to
	// a round-robin rotation between the connected consumers
	Shared

	// Failover subscription mode, multiple consumer will be able to use the same subscription name
	// but only 1 consumer will receive the messages.
	// If that consumer disconnects, one of the other connected consumers will start receiving messages.
	Failover

	// KeyShared subscription mode, multiple consumer will be able to use the same
	// subscription and all messages with the same key will be dispatched to only one consumer
	KeyShared
)

Jump to

Keyboard shortcuts

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