Skip to main content

Kafka操作工具。

Project description

使用手册

快速开始

1)生产者

import kafkaplus

producer = kafkaplus.getProducer("localhost:9092")
# 发送一条消息
producer.send("test_topic", "data-a")

# 同步发送一条消息
producer.sendSync("test_topic", "data-b")

# 批量发送消息
producer.sendBatch("test_topic", "data1", "data2", "data3")

2)消费者

import kafkaplus

# 接收消息的回调函数
def callback(data, **kwargs):
    print(data)
    print(kwargs)

consumer = kafkaplus.getConsumer("localhost:9092")
# 监听topic,使用回调函数处理消息
consumer.onListener("test_topic",group="G-test",callback=callback)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kafkaplus-0.0.1.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distributions

kafkaplus-0.0.1-py3.9.egg (6.4 kB view hashes)

Uploaded Source

kafkaplus-0.0.1-py2.py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page