Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DummyLogger = LoggerFunc(func(string, ...interface{}) {})
DummyLogger dummy logger writes nothing.
Functions ¶
func NewTopicName ¶
NewTopicName 创建优先级topic名字 格式: xxx-high,xxx-medium,xxx-low,xxx-normal
Types ¶
type LoggerFunc ¶
type LoggerFunc func(string, ...interface{})
LoggerFunc is a bridge between Logger and any third party logger.
func (LoggerFunc) Printf ¶
func (f LoggerFunc) Printf(msg string, args ...interface{})
Printf implements Logger interface.
type MQ ¶
type MQ interface { // Publish 发送消息 Publish(ctx context.Context, topic string, msg []byte, opts ...PubOption) error // Subscribe 消费消息 Subscribe(ctx context.Context, topics []string, channel string, subHandler SubHandler, opts ...SubOption) error // Shutdown 平滑退出 Shutdown(ctx context.Context) error }
MQ 优先级队列接口
type SubHandler ¶
SubHandler subscribe func
type SubOption ¶
type SubOption func(s *SubscribeOptions)
SubOption subscribe option
func WithBufferSize ¶
WithBufferSize set priority mq buffer size
func WithCommitOffsetBlock ¶
WithCommitOffsetBlock set consumerGroup commitOffsetBlock
type SubscribeOptions ¶
type SubscribeOptions struct { // specifies the consumer name // for kafka name eq group_id Name string // priority consumer buffer size BufferSize int // Commit the offset to the backend for kafka // Note: calling Commit performs a blocking synchronous operation. CommitOffsetBlock bool }
SubscribeOptions subscribe message option
Click to show internal directories.
Click to hide internal directories.