Safely consume and process data.
Project description
aiosafeconsumer is a library that provides abstractions and some implementations to consume data somewhere and process it.
Features:
Based on AsyncIO
Type annotated
Use logging with contextual information
Abstractions:
DataSource - waits for data and returns batch of records using Python generator
DataProcessor - accepts batch of records and precess it
DataTransformer - accepts batch of records and transform it and calls another processor to precess it. Extends DataProcessor
Worker - abstract worker. Do a long running task
ConsumerWorker - connects DataSource and DataProcessor. Extends Worker
DataWriter - base abstraction to perform data synchronization. Extends DataProcessor
Current implementations:
KafkaSource - read data from Kafka
RedisWriter - synchronize data in Redis
ElasticsearchWriter - synchronize data in Elasticsearch
WorkerPool - controller to setup and run workers in parallel. Can handle worker failures and restarts workers when it fails or exits.
Install:
pip install aiosafeconsumer
Install with Redis:
pip install aiosafeconsumer[redis]
Install with Elasticsearch:
pip install aiosafeconsumer[elasticsearch]
Links:
Producer library: https://github.com/lostclus/django-kafka-streamer
Example application: https://github.com/lostclus/WeatherApp
TODO:
MongoDB writer
PostgreSQL writer
ClickHouse writer
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
Built Distribution
File details
Details for the file aiosafeconsumer-0.0.4.tar.gz
.
File metadata
- Download URL: aiosafeconsumer-0.0.4.tar.gz
- Upload date:
- Size: 31.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 811f2347f23ca3b9d5c11dee5e175975309a4dae0697a25b79353128ef76df75 |
|
MD5 | 86c66ab17aee2acb4c81169c04af6acf |
|
BLAKE2b-256 | d067c5c58e21961a853ab2c7c065ae0eb4baaf6b52e0729efaa93417dfdd4cc5 |
File details
Details for the file aiosafeconsumer-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: aiosafeconsumer-0.0.4-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5eb158d741ab443fa2adad66c4e19a0748e4beb79bd102de2a9c233b7319f68 |
|
MD5 | 87687ea424228ac7e5fcd82a7b34594b |
|
BLAKE2b-256 | dd951db8d6616a90e244978a46d50e1a326130a84fd1669c1b46759c4a7830a1 |