rocketmq

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 13 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
	// 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) 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 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

Jump to

Keyboard shortcuts

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