File: NOTES.md

package info (click to toggle)
python-kafka 0.9.5-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 796 kB
  • sloc: python: 5,853; makefile: 182; sh: 66
file content (32 lines) | stat: -rw-r--r-- 912 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
For 0.8, we have correlation id so we can potentially interleave requests/responses

There are a few levels of abstraction:

* Protocol support: encode/decode the requests/responses
* Socket support: send/recieve messages
* API support: higher level APIs such as: get_topic_metadata


# Methods of producing

* Round robbin (each message to the next partition)
* All-to-one (each message to one partition)
* All-to-all? (each message to every partition)
* Partitioned (run each message through a partitioning function)
** HashPartitioned
** FunctionPartition

# Possible API

    client = KafkaClient("localhost:9092")

    producer = KafkaProducer(client, "topic")
    producer.send_string("hello")

    consumer = KafkaConsumer(client, "group", "topic")
    consumer.seek(10, 2) # seek to beginning (lowest offset)
    consumer.commit() # commit it
    for msg in consumer.iter_messages():
        print msg