rocketmqv4

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg *conf.Configuration) (pubsub.Provider, error)

Types

type ConsumerConfig added in v0.0.4

type ConsumerConfig struct {
	Topic      string
	Group      string
	MessageTag string
	Kind       TopicKind
	// ConsumeMessageBatchMaxSize 单次消费消息数量, 默认以顺序消费合理值1为默认值
	ConsumeMessageBatchMaxSize int
	// MaxReconsumeTimes 最大重试次数,对于顺序消费,其为本地重试次数
	// 最多16次, 10s,30s,1m,此后每次重试的时间间隔是上一次的 2 倍
	MaxReconsumeTimes int
	// SuspendCurrentQueueTimeMillis 消息消费失败后再次被投递给Consumer消费的间隔时间,只在顺序消费中起作用
	// 需要注意的 实际消息次数 = 第一次 + MaxReconsumeTimes + 1, 最后一次暂时不确定
	SuspendCurrentQueueTimeMillis time.Duration
}

type ProducerConfig added in v0.0.4

type ProducerConfig struct {
	Topic      string
	Group      string
	Kind       TopicKind
	RetryTimes int
}

type Provider

type Provider struct {
	ProviderConfig
	// contains filtered or unexported fields
}

func (*Provider) GetMQType

func (p *Provider) GetMQType() string

func (*Provider) Publish

func (p *Provider) Publish(ctx context.Context, opts pubsub.PublishOptions, m *pubsub.Message) (err error)

func (*Provider) Start

func (p *Provider) Start(ctx context.Context) error

func (*Provider) Stop

func (p *Provider) Stop(ctx context.Context) error

Stop consumers and producers.

func (*Provider) Subscribe

func (p *Provider) Subscribe(opts pubsub.HandlerOptions, handler pubsub.MessageHandler) error

type ProviderConfig

type ProviderConfig struct {
	EndPoint   string
	AccessKey  string
	SecretKey  string
	InstanceID string
	Consumers  map[string]ConsumerConfig
	Producers  map[string]ProducerConfig
}

type TopicKind

type TopicKind string
const (
	// TopicKindCommon 普通消息
	TopicKindCommon TopicKind = "common"
	// TopicKindOrderly 顺序消息
	TopicKindOrderly TopicKind = "orderly"
	// TopicKindTiming 定时消息
	TopicKindTiming TopicKind = "timing"
	// TopicKindTrans 事务消息
	TopicKindTrans TopicKind = "trans"
)

Jump to

Keyboard shortcuts

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