Skip to main content

Django Kafka Event Log

Create an event from Django ORM object model, store the event into the database and also publish it into Kafka cluster.

Quick start

  1. Install the package:

    pip install django-kafka-event-log
  2. In your project’s settings.py, include the app and add credentials for Kafka:

    INSTALLED_APPS = [
        ...
        'events',
    ]
    
    KAFKA_GROUP = 'KAFKA_GROUP'
    KAFKA_BOOTSTRAP_SERVERS = 'KAFKA_BOOTSTRAP_SERVERS'
    KAFKA_SECURITY_PROTOCOL = 'KAFKA_SECURITY_PROTOCOL'
    KAFKA_SASL_MECHANISMS = 'KAFKA_SASL_MECHANISMS'
    KAFKA_SASL_USERNAME = 'KAFKA_SASL_USERNAME'
    KAFKA_SASL_PASSWORD = 'KAFKA_SASL_PASSWORD'
  3. Note: the credential should be read from environment variables.

  4. This application has only 1 interface; it is PublishKafkaEventUtil. Given myapp is where the model object locates, MyModelSerializer is the data presenter, we can call the Util like this:

    from events.utils import PublishKafkaEventUtil
    from myapp.serializers.mymodel_serializer import MyModelSerializer
    
    PublishKafkaEventUtil.call(
        event_name='Created',
        model_object=model_obj,
        serializer=ModelSerializer,
        metadata={'purpose': 'testing'},
    )
https://codecov.io/gh/DiagVN/django-kafka-event-log/branch/develop/graph/badge.svg?token=2FtNkItJO7

Metadata

Release files for django-kafka-event-log 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-kafka-event-log 0.1.6
File Size Uploaded
django-kafka-event-log-0.1.6.tar.gz 9.6 kB Details

Release files / django-kafka-event-log-0.1.6.tar.gz

Download URL django-kafka-event-log-0.1.6.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ed7eb601e4446430ec178ff7be9820aeff37107c6f2552f93a4d9ebee8c836c9
BLAKE2b-256 checksum
How to use checksums
62c8713c9ba9448eda6ba0e45f1ada93fd8a5e7a96c37e27a43d93d1c6cf59af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.6 This release

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page