Skip to content

Commit fd45ca5

Browse files
committed
Update README and setup.py with new version
1 parent c275c02 commit fd45ca5

File tree

2 files changed

+57
-44
lines changed

2 files changed

+57
-44
lines changed

README.md

Lines changed: 56 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,61 @@
11
# Kafka Python client
22

3-
This module provides low-level protocol support Apache Kafka. It implements the five basic request types
4-
(and their responses): Produce, Fetch, MultiFetch, MultiProduce, and Offsets. Gzip and Snappy compression
5-
is also supported.
3+
This module provides low-level protocol support for Apache Kafka as well as
4+
high-level consumer and producer classes. Request batching is supported by the
5+
protocol as well as broker-aware request routing. Gzip and Snappy compression
6+
is also supported for message sets.
67

7-
Compatible with Apache Kafka 0.7x. Tested against 0.8
8+
Compatible with Apache Kafka 0.8.1
89

9-
http://incubator.apache.org/kafka/
10+
http://kafka.apache.org/
1011

1112
# License
1213

1314
Copyright 2013, David Arthur under Apache License, v2.0. See `LICENSE`
1415

1516
# Status
1617

17-
Current version is 0.2-alpha. This version is under development, APIs are subject to change
18+
I'm following the version numbers of Kafka, plus one number to indicate the
19+
version of this project. The current version is 0.8.1-1. This version is under
20+
development, APIs are subject to change.
21+
22+
# Usage
23+
24+
## High level
25+
26+
```python
27+
from kafka.client import KafkaClient
28+
from kafka.consumer import SimpleConsumer
29+
from kafka.producer import SimpleProducer
30+
31+
kafka = KafkaClient("localhost", 9092)
32+
33+
producer = SimpleProducer(kafka, "my-topic")
34+
producer.send_messages("some message")
35+
producer.send_messages("this method", "is variadic")
36+
37+
consumer = SimpleConsumer(kafka, "my-group", "my-topic")
38+
for message in consumer:
39+
print(message)
40+
41+
kafka.close()
42+
```
43+
44+
## Low level
45+
46+
```python
47+
from kafka.client import KafkaClient
48+
kafka = KafkaClient("localhost", 9092)
49+
req = ProduceRequest(topic="my-topic", partition=1,
50+
messages=[KafkaProdocol.encode_message("some message")])
51+
resps = kafka.send_produce_request(payloads=[req], fail_on_error=True)
52+
kafka.close()
53+
54+
resps[0].topic # "my-topic"
55+
resps[0].partition # 1
56+
resps[0].error # 0 (hopefully)
57+
resps[0].offset # offset of the first message sent in this request
58+
```
1859

1960
# Install
2061

@@ -60,11 +101,14 @@ pip install python-snappy
60101

61102
# Tests
62103

63-
Some of the tests will fail if Snappy is not installed. These tests will throw NotImplementedError. If you see other failures,
64-
they might be bugs - so please report them!
104+
Some of the tests will fail if Snappy is not installed. These tests will throw
105+
NotImplementedError. If you see other failures, they might be bugs - so please
106+
report them!
65107

66108
## Run the unit tests
67109

110+
_These are broken at the moment_
111+
68112
```shell
69113
python -m test.unit
70114
```
@@ -81,42 +125,11 @@ cd kafka-src
81125
./sbt package
82126
```
83127

84-
Then from the root directory, run the integration tests
128+
Next start up a ZooKeeper server on localhost:2181
85129

86130
```shell
87-
python -m test.integration
131+
/opt/zookeeper/bin/zkServer.sh start
88132
```
89133

90-
# Usage
91-
92-
## High level
93-
94-
```python
95-
from kafka.client import KafkaClient
96-
97-
producer = SimpleProducer(kafka, "my-topic")
98-
producer.send_messages("some message")
99-
producer.send_messages("this method", "is variadic")
100-
101-
consumer = SimpleConsumer(kafka, "my-group", "my-topic")
102-
for message in consumer:
103-
print(message)
104-
105-
kafka.close()
106-
```
107-
108-
## Low level
109-
110-
```python
111-
from kafka.client import KafkaClient
112-
kafka = KafkaClient("localhost", 9092)
113-
req = ProduceRequest(topic="my-topic", partition=1,
114-
messages=[KafkaProdocol.encode_message("some message")])
115-
resps = kafka.send_produce_request(payloads=[req], fail_on_error=True)
116-
kafka.close()
117-
118-
resps[0].topic # "my-topic"
119-
resps[0].partition # 1
120-
resps[0].error # 0 (hopefully)
121-
resps[0].offset # offset of the first message sent in this request
122-
```
134+
This will actually start up real Kafka brokers and send messages in using the
135+
client.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="kafka-python",
5-
version="0.2-alpha",
5+
version="0.8.1-1",
66
author="David Arthur",
77
author_email="[email protected]",
88
url="https://github.com/mumrah/kafka-python",

0 commit comments

Comments
 (0)