Skip to content

Commit 57ca6ff

Browse files
authored
Merge pull request confluentinc#9 from confluentinc/syntax-highlight
Use consistent syntax highlighting (e.g. prefix commands with `$`)
2 parents 46a4e20 + e593445 commit 57ca6ff

File tree

1 file changed

+28
-31
lines changed

1 file changed

+28
-31
lines changed

README.md

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,62 +17,62 @@ Usage
1717

1818
**Producer:**
1919

20-
from confluent_kafka import Producer
20+
```python
21+
from confluent_kafka import Producer
2122

22-
p = Producer({'bootstrap.servers': 'mybroker,mybroker2'})
23-
for data in some_data_source:
24-
p.produce('mytopic', data.encode('utf-8'))
25-
p.flush()
23+
p = Producer({'bootstrap.servers': 'mybroker,mybroker2'})
24+
for data in some_data_source:
25+
p.produce('mytopic', data.encode('utf-8'))
26+
p.flush()
27+
```
2628

2729

2830
**High-level Consumer:**
2931

30-
from confluent_kafka import Consumer
31-
32-
c = Consumer({'bootstrap.servers': 'mybroker', 'group.id': 'mygroup',
33-
'default.topic.config': {'auto.offset.reset': 'smallest'}})
34-
c.subscribe(['mytopic'])
35-
while running:
36-
msg = c.poll()
37-
if not msg.error():
38-
print('Received message: %s' % msg.value().decode('utf-8'))
39-
c.close()
40-
32+
```python
33+
from confluent_kafka import Consumer
4134

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

4345
See [examples](examples) for more examples.
4446

4547

46-
4748
Prerequisites
4849
=============
4950

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

5354

54-
5555
Install
5656
=======
5757

5858
**Install from PyPi:**
5959

60-
pip install confluent-kafka
60+
$ pip install confluent-kafka
6161

6262

6363
**Install from source / tarball:**
6464

65-
pip install .
65+
$ pip install .
6666

6767

6868
Build
6969
=====
7070

71-
python setup.by build
71+
$ python setup.by build
7272

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

75-
CPLUS_INCLUDE_PATH=/path/to/include LIBRARY_PATH=/path/to/lib python setup.py ...
75+
$ CPLUS_INCLUDE_PATH=/path/to/include LIBRARY_PATH=/path/to/lib python setup.py ...
7676

7777

7878
Tests
@@ -81,14 +81,14 @@ Tests
8181

8282
**Run unit-tests:**
8383

84-
py.test
84+
$ py.test
8585

86-
**NOTE**: Requires py.test, install by `pip install pytest`
86+
**NOTE**: Requires `py.test`, install by `pip install pytest`
8787

8888

8989
**Run integration tests:**
9090

91-
examples/integration_test.py <kafka-broker>
91+
$ examples/integration_test.py <kafka-broker>
9292

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

@@ -99,13 +99,10 @@ Generate documentation
9999
======================
100100
Install sphinx and sphinx_rtd_theme packages and then:
101101

102-
make docs
102+
$ make docs
103103

104104
or:
105105

106-
python setup.by build_sphinx
107-
108-
109-
Documentation will be generated in `docs/_build/`
110-
106+
$ python setup.by build_sphinx
111107

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy