Documentation
¶
Index ¶
- Constants
- type Config
- type Consumer
- func InstanceConsumer() (mqClient Consumer, err error)
- func NewConsumer(groupName string) (client Consumer, err error)
- func RegisterKafkaConsumer(connOpt KafkaConfig) (client Consumer, err error)
- func RegisterPulsarConsumer(config PulsarConf) (client Consumer, err error)
- func RegisterRedisMqConsumer(connOpt RedisOption, groupName string) (client Consumer)
- func RegisterRocketConsumer(endPoints []string, groupName string) (client Consumer, err error)
- type KaConsumer
- type Kafka
- func (r *Kafka) ListenReceiveMsgDo(topic string, receiveDo func(msg Msg)) (err error)
- func (r *Kafka) SendByteMsg(topic string, body []byte) (msg Msg, err error)
- func (r *Kafka) SendDelayMsg(topic string, body string, delaySecond int64) (msg Msg, err error)
- func (r *Kafka) SendMsg(topic string, body string) (msg Msg, err error)
- type KafkaConf
- type KafkaConfig
- type Msg
- type Producer
- func InstanceProducer() (client Producer, err error)
- func NewProducer(groupName string) (client Producer, err error)
- func RegisterKafkaProducer(connOpt KafkaConfig) (client Producer, err error)
- func RegisterPulsarProducer(config PulsarConf) (client Producer, err error)
- func RegisterRedisMqProducer(connOpt RedisOption, groupName string) (client Producer)
- func RegisterRocketProducer(endPoints []string, groupName string, retry int) (client Producer, err error)
- type Pulsar
- func (p *Pulsar) Close()
- func (p *Pulsar) ListenReceiveMsgDo(topic string, receiveDo func(msg Msg)) (err error)
- func (p *Pulsar) SendByteMsg(topic string, body []byte) (msg Msg, err error)
- func (p *Pulsar) SendDelayMsg(topic string, body string, delaySecond int64) (msg Msg, err error)
- func (p *Pulsar) SendMsg(topic string, body string) (msg Msg, err error)
- type PulsarConf
- type Queue
- type RedisConf
- type RedisMq
- func (r *RedisMq) ListenReceiveMsgDo(topic string, receiveDo func(mqMsg Msg)) (err error)
- func (r *RedisMq) SendByteMsg(topic string, body []byte) (mqMsg Msg, err error)
- func (r *RedisMq) SendDelayMsg(topic string, body string, delaySecond int64) (msg Msg, err error)
- func (r *RedisMq) SendMsg(topic string, body string) (mqMsg Msg, err error)
- type RedisOption
- type RocketConf
- type RocketMq
- func (r *RocketMq) ListenReceiveMsgDo(topic string, receiveDo func(mqMsg Msg)) (err error)
- func (r *RocketMq) SendByteMsg(topic string, body []byte) (mqMsg Msg, err error)
- func (r *RocketMq) SendDelayMsg(topic string, body string, delaySecond int64) (mqMsg Msg, err error)
- func (r *RocketMq) SendMsg(topic string, body string) (mqMsg Msg, err error)
Constants ¶
const ( SendMsg ReceiveMsg )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Switch bool `json:"switch"` Driver string `json:"driver"` Retry int `json:"retry"` GroupName string `json:"groupName"` Redis RedisConf Rocket RocketConf Kafka KafkaConf Pulsar PulsarConf }
type Consumer ¶
func InstanceConsumer ¶
InstanceConsumer 实例化消费者
func NewConsumer ¶
NewConsumer 初始化消费者实例
func RegisterKafkaConsumer ¶
func RegisterKafkaConsumer(connOpt KafkaConfig) (client Consumer, err error)
RegisterKafkaConsumer 注册消费者
func RegisterPulsarConsumer ¶
func RegisterPulsarConsumer(config PulsarConf) (client Consumer, err error)
RegisterPulsarConsumer creates a consumer for a specific topic and subscription.
func RegisterRedisMqConsumer ¶
func RegisterRedisMqConsumer(connOpt RedisOption, groupName string) (client Consumer)
RegisterRedisMqConsumer 注册消费者
type KaConsumer ¶
type KaConsumer struct {
// contains filtered or unexported fields
}
func (*KaConsumer) Cleanup ¶
func (consumer *KaConsumer) Cleanup(sarama.ConsumerGroupSession) error
Cleanup is run at the end of a session, once all ConsumeClaim goroutines have exited
func (*KaConsumer) ConsumeClaim ¶
func (consumer *KaConsumer) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error
ConsumeClaim must start a consumer loop of ConsumerGroupClaim's Messages().
func (*KaConsumer) Setup ¶
func (consumer *KaConsumer) Setup(sarama.ConsumerGroupSession) error
Setup is run at the beginning of a new session, before ConsumeClaim
type Kafka ¶
type Kafka struct { Partitions int32 // contains filtered or unexported fields }
func (*Kafka) ListenReceiveMsgDo ¶
ListenReceiveMsgDo 消费数据
func (*Kafka) SendByteMsg ¶
SendByteMsg 生产数据
func (*Kafka) SendDelayMsg ¶
type KafkaConfig ¶
type Msg ¶
type Producer ¶
type Producer interface { SendMsg(topic string, body string) (msg Msg, err error) SendByteMsg(topic string, body []byte) (msg Msg, err error) SendDelayMsg(topic string, body string, delaySecond int64) (mqMsg Msg, err error) }
func InstanceProducer ¶
InstanceProducer 实例化生产者
func NewProducer ¶
NewProducer 初始化生产者实例
func RegisterKafkaProducer ¶
func RegisterKafkaProducer(connOpt KafkaConfig) (client Producer, err error)
RegisterKafkaProducer 注册并启动生产者接口实现
func RegisterPulsarProducer ¶
func RegisterPulsarProducer(config PulsarConf) (client Producer, err error)
RegisterPulsarProducer creates a producer for a specific topic.
func RegisterRedisMqProducer ¶
func RegisterRedisMqProducer(connOpt RedisOption, groupName string) (client Producer)
type Pulsar ¶
func (*Pulsar) ListenReceiveMsgDo ¶
ListenReceiveMsgDo 消费数据
func (*Pulsar) SendByteMsg ¶
SendByteMsg 生产数据
func (*Pulsar) SendDelayMsg ¶
type PulsarConf ¶
type RedisMq ¶
type RedisMq struct {
// contains filtered or unexported fields
}
func RegisterRedisMq ¶
func RegisterRedisMq(connOpt RedisOption, groupName string) *RedisMq
RegisterRedisMq 注册redis实例
func (*RedisMq) ListenReceiveMsgDo ¶
ListenReceiveMsgDo 消费数据
func (*RedisMq) SendByteMsg ¶
SendByteMsg 生产数据
func (*RedisMq) SendDelayMsg ¶
type RedisOption ¶
type RedisOption struct {
Timeout int64
}
type RocketConf ¶
type RocketMq ¶
type RocketMq struct {
// contains filtered or unexported fields
}
func RegisterRocketMqConsumer ¶
RegisterRocketMqConsumer 注册rocketmq消费者
func RegisterRocketMqProducer ¶
func RegisterRocketMqProducer(endPoints []string, groupName string, retry int) (mqIns *RocketMq, err error)
RegisterRocketMqProducer 注册rocketmq生产者
func (*RocketMq) ListenReceiveMsgDo ¶
ListenReceiveMsgDo 消费数据
func (*RocketMq) SendByteMsg ¶
SendByteMsg 生产数据