rocketmq

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

README

RocketMQ

Broker: RocketMQ

You can run examples by replace configs use your rocketmq instance configs.

Typically log msg in interceptors, default provide producer and push consumer inteceptor.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogLevel added in v1.3.3

func SetLogLevel(level string)

SetLogLevel set rocket mq log level

Types

type ConsumerConfig

type ConsumerConfig struct {
	Endpoint  []string
	AccessKey string
	SecretKey string

	Topic string
	Gid   string
	Tags  []string
	Retry int32

	Orderly bool

	PullTimeout   time.Duration
	PullBatchSize int32
	// contains filtered or unexported fields
}

ConsumerConfig RocketMQ consumer config

type Interceptor added in v1.3.3

type Interceptor = primitive.Interceptor

Interceptor is an alias of primitive.Interceptor

type Message added in v1.3.3

type Message = primitive.Message

Message is an alias of primitive.Message

type MessageExt added in v1.3.3

type MessageExt = primitive.MessageExt

MessageExt is an alias of primitive.MessageExt

type Producer

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

Producer producer config

func NewProducer

func NewProducer(config *ProducerConfig) *Producer

NewProducer returns a Producer instance

func (*Producer) BatchSendSyncMsg added in v1.3.7

func (p *Producer) BatchSendSyncMsg(ctx context.Context, contents []string, tags ...string) error

BatchSendSyncMsg batch send message sync

func (*Producer) SendAsyncMsg

func (p *Producer) SendAsyncMsg(ctx context.Context, content string, callback func(context.Context, *primitive.SendResult, error), tags ...string) error

SendAsyncMsg send message async

func (*Producer) SendSyncMsg

func (p *Producer) SendSyncMsg(ctx context.Context, content string, tags ...string) error

SendSyncMsg send message sync

func (*Producer) Shutdown

func (p *Producer) Shutdown() error

Shutdown producer

func (*Producer) Start

func (p *Producer) Start() error

Start start producer

type ProducerConfig

type ProducerConfig struct {
	Endpoint  []string
	AccessKey string
	SecretKey string

	Retry       int
	SendTimeout time.Duration

	Topic string
	Gid   string

	SlowSendDuration time.Duration
	// contains filtered or unexported fields
}

ProducerConfig RocketMQ producer config

type PullConsumer added in v1.3.7

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

PullConsumer pull consumer mode

func NewPullConsumer added in v1.3.7

func NewPullConsumer(config *ConsumerConfig) *PullConsumer

NewPullConsumer returns a PullConsumer instance

func (*PullConsumer) Shutdown added in v1.3.7

func (pc *PullConsumer) Shutdown() error

Shutdown consumer

func (*PullConsumer) Start added in v1.3.7

func (pc *PullConsumer) Start() error

Start start consumer

func (*PullConsumer) Subscribe added in v1.3.7

func (pc *PullConsumer) Subscribe(cb func(context.Context, *primitive.MessageExt) error) error

Subscribe subscribe topic

type PushConsumer

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

PushConsumer push consumer mode

func NewPushConsumer

func NewPushConsumer(config *ConsumerConfig) *PushConsumer

NewPushConsumer returns a PushConsumer instance

func (*PushConsumer) Shutdown

func (pc *PushConsumer) Shutdown() error

Shutdown consumer

func (*PushConsumer) Start

func (pc *PushConsumer) Start() error

Start start consumer

func (*PushConsumer) Subscribe

func (pc *PushConsumer) Subscribe(cb func(context.Context, *primitive.MessageExt) error) *PushConsumer

Subscribe subscribe topic

Directories

Path Synopsis
examples
consumer command
producer command

Jump to

Keyboard shortcuts

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