本文整理汇总了Python中kafka.SimpleConsumer.offsets方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleConsumer.offsets方法的具体用法?Python SimpleConsumer.offsets怎么用?Python SimpleConsumer.offsets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kafka.SimpleConsumer
的用法示例。
在下文中一共展示了SimpleConsumer.offsets方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SimpleConsumer
# 需要导入模块: from kafka import SimpleConsumer [as 别名]
# 或者: from kafka.SimpleConsumer import offsets [as 别名]
consumer = SimpleConsumer(client, "bfleming", 'bfleming00615')
print consumer.get_messages(count=10)
# auto_offset_reset='smallest')
import ipdb
ipdb.set_trace()
# Infinite iteration
# for m in consumer:
# print m
# consumer.task_done(m)
# do_some_work(m)
# Mark this message as fully consumed
# so it can be included in the next commit
#
# **messages that are not marked w/ task_done currently do not commit!
# consumer.task_done(m)
# If auto_commit_enable is False, remember to commit() periodically
# consumer.commit()
# Batch process interface
while True:
for m in consumer.fetch_messages():
# process_message(m)
print m
print consumer.offsets()
import ipdb
ipdb.set_trace()
# consumer.task_done(m)
# consumer.commitOffsets(true)