rocketmq

package
v0.0.0-...-7206171 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MulanPSL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DEBUG = true
)

Functions

func ConsumeMsg

func ConsumeMsg(name string, numOfMessages int32, waitSeconds int64, consumeFunc func(topic string, msg MqMsg) *common.LResult)

ConsumeMsg 消费消息

func ConsumeMsg2

func ConsumeMsg2(name string, numOfMessages int32, waitSeconds int64, consumeFunc func(topic string, msg MqMsg) *common.LResult)

ConsumeMsg2 消费消息

func ExecuteConsumeMsg

func ExecuteConsumeMsg(topic string, cli mqHttpSdk.MQConsumer, numOfMessages int32, waitSeconds int64, consumeFunc func(topic string, msg MqMsg) *common.LResult)

ExecuteConsumeMsg 执行消费消息

func ExecutePublishMsg

func ExecutePublishMsg(name string, msg MqMsg) (bool, error)

ExecutePublishMsg 执行发送消息

func GetConsumer

func GetConsumer(name string) mqHttpSdk.MQConsumer

func GetProducer

func GetProducer(name string) mqHttpSdk.MQProducer

func Init

func Init(cfg *config.RocketmqConfig) bool

func InitConsumer

func InitConsumer(config *MqConsumerConfig)

func InitMq

func InitMq(mqConf *MqConfig)

func InitProducer

func InitProducer(config *MqProducerConfig)

func PublishMsg

func PublishMsg(name string, msg MqMsg) (bool, error)

PublishMsg 发送消息

Types

type MqConfig

type MqConfig struct {
	Endpoint  string // 设置HTTP接入域名(此处以公共云生产环境为例)
	AccessKey string // AccessKey 阿里云身份验证,在阿里云服务器管理控制台创建
	SecretKey string // SecretKey 阿里云身份验证,在阿里云服务器管理控制台创建
}

type MqConsumerConfig

type MqConsumerConfig struct {
	Name       string // 客户端名字
	Topic      string // 所属的 Topic
	Group      string // 您在控制台创建的 Consumer ID(Group ID)
	InstanceId string // Topic所属实例ID,默认实例为空
}

type MqMsg

type MqMsg struct {
	MessageBody string            // 消息内容
	MessageTag  string            // 消息标签
	Properties  map[string]string // 消息属性
	MessageKey  string            // 消息KEY
}

type MqProducerConfig

type MqProducerConfig struct {
	Name       string // 生产者名字
	Topic      string // 所属的 Topic
	InstanceId string // Topic所属实例ID,默认实例为空
}

type MqWorker

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

func NewMqWorker

func NewMqWorker(ctx context.Context, topic string, numOfMessages int32, waitSeconds int64, consumeFunc func(topic string, msg MqMsg) *common.LResult) *MqWorker

func (*MqWorker) Run

func (w *MqWorker) Run()

func (*MqWorker) Stop

func (w *MqWorker) Stop()

Jump to

Keyboard shortcuts

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