kafka-collector
Collect Kafka messages from multiple topics. Ships as a CLI and a microservice (HTTP capture management).
kafka-collector is the first step in a three-tool workflow to record, reshape, and replay Kafka traffic (often into a development cluster). Captures are usually JSONL; use the companion repos below to turn them into emulator config and produce messages again.
Related repositories (recommended workflow)
This project works best in sequence with:
| Step | Repository | Role |
|---|---|---|
| 1 | kafka-collector (this repo) | Collect messages from Kafka topics (CLI + microservice). |
| 2 | collector-to-emulator | Convert collected JSONL into files/config usable by the emulator. |
| 3 | kafka-emulator | Produce the configured messages onto Kafka (e.g. dev). |
Typical flow
- Use kafka-collector to capture traffic from the topics you care about.
- Use collector-to-emulator to generate an emulator configuration from those captures.
- Edit the config as needed (secrets, ordering, scenarios, gaps).
- Use kafka-emulator to replay messages to your target Kafka.
Together: collect → convert → curate → replay. For flags, modes, and deployment, see the sections below and Documentation.
Installation
pip install kafka_collector
Usage
$ kafka-collector -h
usage: kafka-collector [-h] [-v] [-t TOPICS] [-b BOOTSTRAP_SERVER] [-g GROUP]
[-o OUTPUT] [-c CAPTURE_DIR] [-m {cli,service}]
[-p PORT]
[--log-level {debug,info,warning,error,critical}]
[--debug]
collect kafka messages from multiple topics
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-t, --topics TOPICS comma separated list of kafka topics to be listened to
-b, --bootstrap-server BOOTSTRAP_SERVER
kafka bootstrap server (default: localhost:9092)
-g, --group GROUP consumer group id (default: random uuid)
-o, --output OUTPUT output file path, use '-' for stdout (default: stdout)
-c, --capture-dir CAPTURE_DIR
capture directory for service mode (default:
/tmp/kafka-collector)
-m, --mode {cli,service}
run mode: cli or service (default: cli)
-p, --port PORT service port for service mode (default: 8080)
--log-level {debug,info,warning,error,critical}
logging level (default: info)
--debug enable debug logging (shortcut for --log-level debug)
Environment Variables
KAFKA_TOPICS- comma separated list of topicsKAFKA_BOOTSTRAP_SERVER- bootstrap server addressKAFKA_GROUP- consumer group idCOLLECTOR_CAPTURE_DIR- capture directory for service modeCOLLECTOR_MODE- run mode (cli or service)COLLECTOR_SERVICE_PORT- service port (must be integer)LOG_LEVEL- logging level
Documentation
- CLI Mode - Default mode for streaming messages to stdout or file
- Service Mode - HTTP service mode with REST API for capture management
Deployment Examples
- Docker Compose - Run with Docker Compose
- Kubernetes - Deploy to Kubernetes
Links
Metadata
Release files for kafka_collector 1.1.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 |
|---|---|---|---|---|
| kafka_collector-1.1.0.tar.gz | 13.1 kB | Without provenance | Details for kafka_collector-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kafka_collector-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for kafka_collector-1.1.0-py3-none-any.whl |
Total release size: 28.3 kB
Release files / kafka_collector-1.1.0.tar.gz
| Download URL | kafka_collector-1.1.0.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
01cf335617ed5fd90580f095137eb217149c6b91c45a276721dc5f19e80803dd
|
|
BLAKE2b-256 checksum How to use checksums |
d146628a9b15be0fbd97fbb5ad0e32979a5e4123124b25b51347feecb6d29dfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.15.2 Linux/7.0.0-1019-azure
|
Release files / kafka_collector-1.1.0-py3-none-any.whl
| Download URL | kafka_collector-1.1.0-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02a1efb3a1dedc135233dd31de0a8f91981e802ed6e1f37c220326a90b2f879e
|
|
BLAKE2b-256 checksum How to use checksums |
447a763a7575743143f997d52a0a53675b6ce7b96b79f06d58e200df6bedaf4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.15.2 Linux/7.0.0-1019-azure
|
Security for kafka_collector 1.1.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.