Django Kafka Consumer
Purpose
Django Kafka Consumer is an utility for consume events from Kafka
Quick start
-
Add
kafka_consumerto yourINSTALLED_APPSsetting like this:INSTALLED_APPS = [ # ... 'kafka_consumer', ] -
Run
python manage.py migrateto create thekafka_consumermodels. -
Add custom subscribers as classes derived from
kafka_consumer.subscribers.base.BaseSubscriber -
Prepare settings:
KAFKA_HOSTS = ['kafka-host.com:9092'] KAFKA_CONSUMER_TOPICS = { 'topic_key': { 'topic': 'topic name', # no spaces allowed! 'group': 'topic group', 'client': 'client ID', 'subscribers': ( 'path.to.subscriber.Class', ), 'message_processor': 'processor key', # lookup in KAFKA_CONSUMERS_MESSAGE_PROCESSORS 'wait': 0, # optional, indicates how many seconds Kafka will wait to fillup buffer, None or ommited means wait forever 'max_number_of_messages_in_batch': 200, 'consumer_options': { # Overrides options used to create KafkaConsumer 'auto_offset_reset': 'latest', } }, } KAFKA_CONSUMERS_MESSAGE_PROCESSORS = { 'processor key': { 'class': 'path.to.messageprocessor.Class', # Processors init arguments, e.g. 'rsa_private_key_path': 'path/to/private/key' }, } KAFKA_CONSUMER_SSL_SETTINGS = { 'security_protocol': 'SSL', 'ssl_cafile': '/path/to/file/ca.crt', 'ssl_certfile': '/path/to/file/signed.request.crt', 'ssl_keyfile': '/path/to/some/keyfile.key', } -
To continuously consume events from kafka run:
python manage.py consume --supervised --topic topic_key
License
The Django Kafka Consumer package is licensed under the FreeBSD License.
Metadata
Release files for django-kafka-consumer 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-kafka-consumer-2.0.0.tar.gz | 19.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_kafka_consumer-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.3 kB
Release files / django-kafka-consumer-2.0.0.tar.gz
| Download URL | django-kafka-consumer-2.0.0.tar.gz |
|---|---|
| Size | 19.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0084715d0cb854038c9f4eebcbc8824b1c22d41e945623e64714a48578d019a
|
|
BLAKE2b-256 checksum How to use checksums |
d74e92974b43193d88202b83d21119394cda294d1fa583781cf55da71ee5d499
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.9.12 Linux/5.13.0-1021-azure
|
Release files / django_kafka_consumer-2.0.0-py3-none-any.whl
| Download URL | django_kafka_consumer-2.0.0-py3-none-any.whl |
|---|---|
| Size | 31.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d96d95a845694af58aa35d59d67d7d81127e9331283a22f7a6aefe8423512ccc
|
|
BLAKE2b-256 checksum How to use checksums |
1f798b5d1f23ab79658e6af0736526cd227c03e17714811ad8a60057ef1f89c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.9.12 Linux/5.13.0-1021-azure
|
Security for django-kafka-consumer 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.