Skip to main content

Base Consumer

The Base Consumer is a class that you will extend to create your own consumer. It provides a few helper methods that make it easier to interact with the Kafka cluster. It also offers built-in logging capabilities. Example:

from base_consumer import BaseKafkaConsumer

class EmailConsumer(BaseKafkaConsumer):
    def __init__(self):
        super().__init__(
            broker_url="localhost:9092",
            topic="email",
            group_id="email-consumer",
            log_file="email_consumer.log",
        )
        log_level = os.environ.get("LOG_LEVEL", "INFO")
        self.set_logger_level(log_level) # default is INFO if not set

    def process_message(self, message: dict):
        # do something with the message
        print(message)


if __name__ == "__main__":
    consumer = EmailConsumer()
    consumer.consume()

Metadata

Release files for base-consumer 0.1.2

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

Source distribution (sdist)

Source distribution for base-consumer 0.1.2
File Size Uploaded
base_consumer-0.1.2.tar.gz 2.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for base-consumer 0.1.2
File Interpreter ABI Platform
base_consumer-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 4.7 kB

Release files / base_consumer-0.1.2.tar.gz

Download URL base_consumer-0.1.2.tar.gz
Size 2.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e4439608a3d91b1e2809b5e5389b1c28b4ef00eaa9816a4468f273794c2041aa
BLAKE2b-256 checksum
How to use checksums
5852a43180386965c5cc55bdd0d9827d80d3ca2b212d95a3a4cc23a60853f4cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.2 Darwin/24.4.0

Release files / base_consumer-0.1.2-py3-none-any.whl

Download URL base_consumer-0.1.2-py3-none-any.whl
Size 2.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce2bb4b6f2b61e7fdb9d5db6c2aef53c81b248de95be803dae3f356bd242bb7f
BLAKE2b-256 checksum
How to use checksums
d2e49f45ecd3ce3f0e5ba882479898e9652d349709b937d4528a4bfcbdb8fafa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.2 Darwin/24.4.0

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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