stanq

package
v0.0.0-...-5d40105 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewConsumerManager

func MustNewConsumerManager(cfg *StanqConfig, cq []*ConsumerQueue) queue.MessageQueue

MustNewConsumerManager

Types

type ConsumeHandle

type ConsumeHandle func(m *stan.Msg) error

type ConsumeHandler

type ConsumeHandler interface {
	HandleMessage(m *stan.Msg) error
}

ConsumeHandler Consumer interface, used to define the methods required by the consumer

type ConsumerManager

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

ConsumerManager Consumer manager for managing multiple consumer queues

func (*ConsumerManager) Start

func (cm *ConsumerManager) Start()

Start consuming messages in the queue

func (*ConsumerManager) Stop

func (cm *ConsumerManager) Stop()

Stop close connect

type ConsumerQueue

type ConsumerQueue struct {
	GroupName     string                    // consumer group name
	QueueName     string                    // queue name
	Subject       string                    // Subscribe subject
	Consumer      ConsumeHandler            // consumer object
	AckWaitTime   int                       // Waiting time for Ack
	MaxInflight   int                       // Maximum number of unacked messages
	ManualAckMode bool                      //Whether to manually ack
	Options       []stan.SubscriptionOption // Subscription configuration item
}

ConsumerQueue Consumer queue, used to maintain the relationship between a consumer group and queue

type Producer

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

func NewProducer

func NewProducer(c *StanqConfig) (*Producer, error)

func (*Producer) AsyncPublish

func (p *Producer) AsyncPublish(subject string, data []byte, ackHandler func(guid string, err error)) (string, error)

func (*Producer) Close

func (p *Producer) Close()

func (*Producer) Publish

func (p *Producer) Publish(subject string, data []byte) error

type StanqConfig

type StanqConfig struct {
	ClusterID string        `json:"cluster_id"`
	ClientID  string        `json:"client_id"`
	Options   []stan.Option `json:"options"`
}

Jump to

Keyboard shortcuts

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