mq

package
v0.0.0-...-6cf1638 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MulanPSL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConsumer

func InitConsumer()

InitConsumer 创建一个新的Kafka消费者实例

func InitProducer

func InitProducer()

InitProducer 创建一个新的 Kafka 生产者

Types

type KafkaConsumer

type KafkaConsumer struct {
	// contains filtered or unexported fields
}
var KafkaConsumerHandler *KafkaConsumer

func (*KafkaConsumer) Close

func (kc *KafkaConsumer) Close() error

Close 关闭消费者连接

func (*KafkaConsumer) Consume

func (kc *KafkaConsumer) Consume()

Consume 消费指定主题的消息

type KafkaProducer

type KafkaProducer struct {
	// contains filtered or unexported fields
}
var KafkaProducerHandler KafkaProducer

func (*KafkaProducer) Close

func (p *KafkaProducer) Close() error

Close 关闭生产者

func (*KafkaProducer) Produce

func (p *KafkaProducer) Produce(msg *sarama.ProducerMessage) (int32, int64, error)

Produce 向 Kafka 主题发送消息

Jump to

Keyboard shortcuts

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