Skip to content

Use consistent syntax highlighting (e.g. prefix commands with $) #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 28 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,62 +17,62 @@ Usage

**Producer:**

from confluent_kafka import Producer
```python
from confluent_kafka import Producer

p = Producer({'bootstrap.servers': 'mybroker,mybroker2'})
for data in some_data_source:
p.produce('mytopic', data.encode('utf-8'))
p.flush()
p = Producer({'bootstrap.servers': 'mybroker,mybroker2'})
for data in some_data_source:
p.produce('mytopic', data.encode('utf-8'))
p.flush()
```


**High-level Consumer:**

from confluent_kafka import Consumer

c = Consumer({'bootstrap.servers': 'mybroker', 'group.id': 'mygroup',
'default.topic.config': {'auto.offset.reset': 'smallest'}})
c.subscribe(['mytopic'])
while running:
msg = c.poll()
if not msg.error():
print('Received message: %s' % msg.value().decode('utf-8'))
c.close()

```python
from confluent_kafka import Consumer

c = Consumer({'bootstrap.servers': 'mybroker', 'group.id': 'mygroup',
'default.topic.config': {'auto.offset.reset': 'smallest'}})
c.subscribe(['mytopic'])
while running:
msg = c.poll()
if not msg.error():
print('Received message: %s' % msg.value().decode('utf-8'))
c.close()
```

See [examples](examples) for more examples.



Prerequisites
=============

* Python >= 2.7 or Python 3.x
* [librdkafka](https://github.com/edenhill/librdkafka) >= 0.9.1



Install
=======

**Install from PyPi:**

pip install confluent-kafka
$ pip install confluent-kafka


**Install from source / tarball:**

pip install .
$ pip install .


Build
=====

python setup.by build
$ python setup.by build

If librdkafka is installed in a non-standard location provide the include and library directories with:

CPLUS_INCLUDE_PATH=/path/to/include LIBRARY_PATH=/path/to/lib python setup.py ...
$ CPLUS_INCLUDE_PATH=/path/to/include LIBRARY_PATH=/path/to/lib python setup.py ...


Tests
Expand All @@ -81,14 +81,14 @@ Tests

**Run unit-tests:**

py.test
$ py.test

**NOTE**: Requires py.test, install by `pip install pytest`
**NOTE**: Requires `py.test`, install by `pip install pytest`


**Run integration tests:**

examples/integration_test.py <kafka-broker>
$ examples/integration_test.py <kafka-broker>

**WARNING**: These tests require an active Kafka cluster and will make use of a topic named 'test'.

Expand All @@ -99,13 +99,10 @@ Generate documentation
======================
Install sphinx and sphinx_rtd_theme packages and then:

make docs
$ make docs

or:

python setup.by build_sphinx


Documentation will be generated in `docs/_build/`

$ python setup.by build_sphinx

Documentation will be generated in `docs/_build/`.