Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

kafka get last offset of topic python

from kafka import SimpleClient
from kafka.protocol.offset import OffsetRequest, OffsetResetStrategy
from kafka.common import OffsetRequestPayload

client = SimpleClient(brokers)

partitions = client.topic_partitions[topic]
offset_requests = [OffsetRequestPayload(topic, p, -1, 1) for p in partitions.keys()]

offsets_responses = client.send_offset_request(offset_requests)

for r in offsets_responses:
    print "partition = %s, offset = %s"%(r.partition, r.offsets[0])
Comment

PREVIOUS NEXT
Code Example
Python :: Make a basic pygame window 
Python :: Beautifulsoup - How to open images and download them 
Python :: rotate point around point python 
Python :: np.polyfit plot 
Python :: Add Border to input Pysimplegui 
Python :: copyfile pyhon 
Python :: how to extract integers from string python 
Python :: dataframe create 
Python :: get only every 2 rows pandas 
Python :: convert float in datetime python 
Python :: multiprocessing a for loop python 
Python :: how to change plot size in matplotlib 
Python :: hex python add 0 
Python :: python spotify player 
Python :: Delete file in python Using the os module 
Python :: python multiline string 
Python :: plt.savefig specify dpi 
Python :: beautiful soup documentation 
Python :: find sum of 2 numbers in array using python 
Python :: python list prime numbers 
Python :: list the available fonts matplotlib 
Python :: max date by group pandas 
Python :: isolate row based on index pandas 
Python :: lowercase all text in a column 
Python :: get variable name python 
Python :: ComplexWarning: Casting complex values to real discards the imaginary part 
Python :: print statement in python 
Python :: python list splicing 
Python :: create a blank image numpy 
Python :: discord.py how get user input 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =