-
Notifications
You must be signed in to change notification settings - Fork 934
Py3: use bytes for Message payload and key #4
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
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,94 @@ | ||
| Confluent's Apache Kafka client for Python | ||
| ========================================== | ||
|
|
||
| Confluent's Kafka client for Python wraps the librdkafka C library, providing | ||
| full Kafka protocol support at great performance and reliability. | ||
|
|
||
| Prerequisites | ||
| =============== | ||
| The Python bindings provides a high-level Producer and Consumer with support | ||
| for the balanced consumer groups of Apache Kafka 0.9. | ||
|
|
||
| librdkafka >=0.9.1 (or master>=2016-04-13) | ||
| py.test (pip install pytest) | ||
| See the [API documentation](http://docs.confluent.io/3.0.0/clients/confluent-kafka-python/index.html) for more info. | ||
|
||
|
|
||
|
|
||
| Build | ||
| Usage | ||
| ===== | ||
|
|
||
| python setup.by build | ||
| **Producer:** | ||
|
|
||
| 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() | ||
|
|
||
|
|
||
| **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() | ||
|
|
||
|
|
||
|
|
||
| See [examples](examples) for more examples. | ||
|
|
||
|
|
||
|
|
||
| Prerequisites | ||
| ============= | ||
|
|
||
| * Python >= 2.7 or Python 3.x | ||
| * [librdkafka](https://github.com/edenhill/librdkafka) >= 0.9.1 | ||
|
|
||
|
|
||
|
|
||
| Install | ||
| ======= | ||
| Preferably in a virtualenv: | ||
|
|
||
| **Install from PyPi:** | ||
|
|
||
| pip install confluent-kafka | ||
|
|
||
|
|
||
| **Install from source / tarball:** | ||
|
|
||
| pip install . | ||
|
|
||
|
|
||
| Run unit-tests | ||
| ============== | ||
| Build | ||
| ===== | ||
|
|
||
| python setup.by build | ||
|
|
||
|
|
||
|
|
||
|
|
||
| Tests | ||
| ===== | ||
|
|
||
|
|
||
| **Run unit-tests:** | ||
|
|
||
| py.test | ||
|
|
||
| **NOTE**: Requires py.test, install by `pip install pytest` | ||
|
|
||
| Run integration tests | ||
| ===================== | ||
| **WARNING**: These tests require an active Kafka cluster and will make use of a topic named 'test'. | ||
|
|
||
| **Run integration tests:** | ||
|
|
||
| examples/integration_test.py <kafka-broker> | ||
|
|
||
| **WARNING**: These tests require an active Kafka cluster and will make use of a topic named 'test'. | ||
|
|
||
|
|
||
|
|
||
|
|
||
| Generate documentation | ||
|
|
@@ -51,7 +105,3 @@ or: | |
| Documentation will be generated in `docs/_build/` | ||
|
|
||
|
|
||
| Examples | ||
| ======== | ||
|
|
||
| See [examples](examples) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
support at great -> support with great