rocketmq5Kit

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AwaitDuration (consumer创建实例时用到) maximum waiting time for receive func
	AwaitDuration = time.Second * 5

	// MaxMessageNum (consumer收消息时用到) maximum number of messages received at one time
	MaxMessageNum int32 = 16

	// InvisibleDuration (consumer收消息时用到) InvisibleDuration should > 20s
	InvisibleDuration = time.Second * 20
)

Variables

This section is empty.

Functions

func GetTagString

func GetTagString(tag *string) string

func MixTags

func MixTags(tags ...string) string

func NewProducer

func NewProducer(logConfig *LogConfig, config *rmq_client.Config) (rmq_client.Producer, error)

NewProducer

@param logConfig 可以为nil @return rmq_client.Producer实例要手动调用 Start()!!!

func NewSimpleConsumer

func NewSimpleConsumer(logConfig *LogConfig, config *rmq_client.Config, consumerGroup, topic, tag string) (rmq_client.SimpleConsumer, error)

NewSimpleConsumer

@param logConfig 可以为nil(此时将默认输出到控制台) @param config 不会修改传参config,因为修改的是副本 @return rmq_client.SimpleConsumer实例要手动调用 Start()!!!

func SendMessage deprecated

func SendMessage(producer rmq_client.Producer, topic string, body []byte, tag *string, keys ...string) (*rmq_client.SendReceipt, error)

SendMessage

Deprecated: 此方法仅供参考.

@param tag 可以为nil

func SendMessageForSendReceipts deprecated

func SendMessageForSendReceipts(producer rmq_client.Producer, topic string, body []byte, tag *string, keys ...string) ([]*rmq_client.SendReceipt, error)

SendMessageForSendReceipts

Deprecated: 此方法仅供参考.

func VerifyEndpoint

func VerifyEndpoint(endpoint, topic string) error

VerifyEndpoint 测试RocketMQ5服务是否启动正常.

@param endpoint 用于测试的RocketMQ5服务的endpoint @param topic 用于测试的topic(理论上,此topic仅用于测试,不能同时用于业务,因为测试发的消息无意义) @return 如果为nil,说明 RocketMQ5服务 正常启动

Types

type Config

type Config struct {
	rmq_client.Config
	TopicToVerify string
}

type LogConfig

type LogConfig struct {
	// ToConsole RocketMQ5的客户端日志是否输出到控制台?
	ToConsole bool
	// LogDir RocketMQ5的客户端日志要输出到文件的情况下,日志所在的目录
	LogDir string
	// LogName RocketMQ5的客户端日志要输出到文件的情况下,日志的文件名
	LogName string
}

LogConfig 如果输出到日志文件且该文件已存在,会"追加到最后面".

func (*LogConfig) SetLogout

func (lc *LogConfig) SetLogout() error

SetLogout

!!!: 如果是输出到文件的话,由于使用的是系统变量,需要考虑"并发问题".

Jump to

Keyboard shortcuts

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