Skip to main content

aioworkers plugin for kafka

Project description

https://img.shields.io/pypi/v/aioworkers-kafka.svg https://github.com/aioworkers/aioworkers-kafka/workflows/Tests/badge.svg Coverage Code style: ruff Code style: Mypy Documentation Status Python versions https://img.shields.io/pypi/dm/aioworkers-kafka.svg Hatch project

Usage

config.yaml:

producer:
  cls: aioworkers_kafka.producer.KafkaProducer
  format: json
  kafka:
    bootstrap.servers: kafka:9092
  topic: test

consumer:
  cls: aioworkers_kafka.consumer.KafkaConsumer
  format: json  # default format is json
  kafka:
    bootstrap.servers: kafka:9092
    group.id: test
  topics:
    - test

worker:
  cls: mymodule.MyWorker
  input: .consumer
  output: .producer
  autorun: true

mymodule.py:

from aioworkers.worker.base import Worker

class MyWorker(Worker):
    async def run(self, value):  # consume value from input
        assert isinstance(value, dict)

        value["test"] += 1

        return value  # produce value to output
$ aioworkers -c config.yaml

Development

Check code:

hatch run lint:all

Format code:

hatch run lint:fmt

Run tests:

hatch run pytest

Run tests with coverage:

hatch run cov

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

aioworkers_kafka-0.2.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aioworkers_kafka-0.2.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file aioworkers_kafka-0.2.0.tar.gz.

File metadata

  • Download URL: aioworkers_kafka-0.2.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for aioworkers_kafka-0.2.0.tar.gz
Algorithm Hash digest
SHA256 453d9a1039182692b9ba38f8c904b4fe7cd185fdb4ca352ae653130603ba22ed
MD5 be246c116bd6de67f6878126053f3386
BLAKE2b-256 28fa80c3f5550b6a6c3333cf1ea9e39479470f90a30b4f0caceffce7b805c30c

See more details on using hashes here.

File details

Details for the file aioworkers_kafka-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aioworkers_kafka-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8cc731deeea3e930830b30cfd6b35d08af693502d71c805314f8fc56437ac784
MD5 90b7cfc7ca7e75ca0a8386ea10e7f3f2
BLAKE2b-256 ff3e8e9e2e794037429269238143e57e8f366d5fd97321999d73def4b5c3573a

See more details on using hashes here.

Supported by

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