Skip to main content

A simple Django app to enable enable a catch all ingress

Project description

Data Ingress

This is a simple ingress app which stores all incoming messages in a queue categorized into collections.

Data is always posted in the form of messages to a specific collection, and can be processed from the queue by consumers.

Usage:

1. Add the app

Enable in installed apps:

INSTALLED_APPS = [
    ...,
    'ingress'
]

2. Create and configure a consumer

Implement a consumer to handle the data. Note: the ingress can be deployed without a consumer when you (probably temporarily) want to ingest data, but not consume it.

class MyConsumer(IngressConsumer):
    collection_name = 'foobar'

    def consume_message(self):
        ...

    # by default consume_batch() loops and calls consume_message(), but it can be 
    # overridden to have more control, for instance to bulk insert into the db.
    def consume_batch(self):
        ...

Configure the consumer in settings.py. Each consumer must implement the BaseConsumer and implement the proper methods (see above). On consumption consumers are passed all messages in the collection that corresponds to Consumer.collection_name.

# A list of classpaths to implementations of ingress.consumer.IngressConsumer
# to handle the data in the queue.
INGRESS_CONSUMER_CLASSES = ['app.module.MyConsumer']

3. Authentication and Authorization

Configure at least the authentication classes or permission classes:

# A list of authentication classes used in the ingress view.
# See https://www.django-rest-framework.org/api-guide/authentication/
INGRESS_AUTHENTICATION_CLASSES = []

# A list of permission classes used in the ingress view.
# See https://www.django-rest-framework.org/api-guide/permissions/
INGRESS_PERMISSION_CLASSES = []

4. Accept data posted to non-existing collections?

By default data posted to non-existing collections is not stored, and an error is returned for such requests.

If data posted to non-existing collections should be stored, modify the setting:

# Whether or not to accept data posted to a non-existing collection.
INGRESS_ACCEPT_NEW_COLLECTIONS = False

5. Set encoding when other than UTF-8

By default the ingress decodes all incoming data using UTF-8. If the data needs to be decoded differently before being stored in the database, configure the setting:

# Encoding that the data will be in when posted to the ingress
INGRESS_ENCODING = "utf-16"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datapunt-data-ingress-2.1.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

datapunt_data_ingress-2.1.0-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file datapunt-data-ingress-2.1.0.tar.gz.

File metadata

  • Download URL: datapunt-data-ingress-2.1.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0

File hashes

Hashes for datapunt-data-ingress-2.1.0.tar.gz
Algorithm Hash digest
SHA256 6c660cc9af8637ca1eeffbe3f0d93cde737a5bc79917f510ea1f64e17753d3ec
MD5 7325c44d6c01002b3e550440a4929eb0
BLAKE2b-256 322f4cb9f707e8c9e8eaf7dbf9a2639ea33927b37f8cec5572392c2e7ad4183f

See more details on using hashes here.

File details

Details for the file datapunt_data_ingress-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: datapunt_data_ingress-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0

File hashes

Hashes for datapunt_data_ingress-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15ef82ee92d786d9f4347e8aa2cf743b2a1b204458c746b2516521f09933d2e7
MD5 1a02e78ddab27973f88d450258fc007a
BLAKE2b-256 41dd3163bedba3bbb122e5d1c5a93350aaf54a47c51c8d1b151135cd07342f36

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page