Busie Consumer
A base consumer package for Busie projects. Abstracts polling and configuration setup away from the end user and exposes basic api for starting the poll process.
Installation
pip install busie-consumer
Usage
from busie_consumer import BaseConsumer
CONFIG = {
'bootstrap.servers': 'localhost:9092',
# Other Config as necessary
}
consumer = BaseConsumer(topics=['some-topic', 'another'], config=CONFIG)
for message in consumer.start():
handle_message(message)
# It may also be helpful to extend this base class and provide helper methods
class HigherLevelConsumer(Consumer):
def handle_message(self, message):
# process the message
reply_topic, reply = determine_reply(message)
self.send_reply(topic=reply_topic, message=reply, key=message.key())
consumer = HigherLevelConsumer(topics=['topic'], config=CONFIG)
for msg in consumer.start():
consumer.handle_message(msg)
API
BaseConsumer
Public Methods
BaseConsumer(topics=None, config=None): Constructor- required param
topics: An iterable of strings containing topic names - required param
config: Adictcontaining Kafka config Noteconfigmust havebootstrap.serversandgroup.identries
- required param
start(): Generator methods. initiates polling. returns a generatorclose(): Closes the consumersend_reply(topic=None, message=None, key=None): Invokes a producer and uses it to send a reply to the desired topic. Especially helpful for theSaga OrchestratorPattern Note The producer assumes the same config as the consumer class- required param
topic: A string representing the desired topic name - required param
message: The data to send to the desired topic. - required param
key: The desired key for the message
- required param
Metadata
Release files for busie-consumer 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| busie-consumer-1.0.0.tar.gz | 3.6 kB | Without provenance | Details for busie-consumer-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| busie_consumer-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for busie_consumer-1.0.0-py3-none-any.whl |
Total release size: 8.5 kB
Release files / busie-consumer-1.0.0.tar.gz
| Download URL | busie-consumer-1.0.0.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3b4741c7cb9ecff3a8558c162cf3d4214303bdce5feb3d3f9e6905f2e336c5d
|
|
BLAKE2b-256 checksum How to use checksums |
5d8f924422a646be7a545f6eeac0e01231ee0333291a40b26bcac5b61da3c0e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9
|
Release files / busie_consumer-1.0.0-py3-none-any.whl
| Download URL | busie_consumer-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e5e2bda1e7563cc6badbc5e1a23acf5010a209cc3fc49fc8dd94012f1040512
|
|
BLAKE2b-256 checksum How to use checksums |
608f03c8c0952721a1f831e96910f56e5272ffd3d1ec8d9166c40baf70bb2cb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9
|
Security for busie-consumer 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.