Skip to main content

A CLI tool to fetch Kafka messages within a specified time range

Project description

Kafka Replay CLI

PyPI version License

A simple command-line tool to fetch Kafka messages from a specific time range. Useful for replaying messages or debugging Kafka topics.


🚀 Installation

Install from PyPI:

pip install kafka-replay

🔧 Usage

kafka-replay --broker <KAFKA_BROKER> --topic <TOPIC> --start-time "<START_TIME>" --end-time "<END_TIME>"

Example:

kafka-replay --broker "localhost:9092" --topic "my_topic" --start-time "2024-03-31 10:00:00" --end-time "2024-03-31 11:00:00"

To save the output to a file:

kafka-replay --broker "localhost:9092" --topic "my_topic" --start-time "2024-03-31 10:00:00" --end-time "2024-03-31 11:00:00" --output results.json

Using as a Library You can also use it in Python scripts:

from kafka_replay import KafkaReplay

kafka = KafkaReplay(broker="localhost:9092", topic="my_topic")
messages = kafka.fetch_messages("2024-03-31 10:00:00", "2024-03-31 11:00:00")

print(messages)

🛠 Features Fetch Kafka messages between a given time range.

Supports CLI and Python API usage.

Saves output as JSON file (optional).

Graceful error handling.


📜 License This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing Contributions are welcome! Please open an issue or submit a pull request.

Next Steps Add tests

Improve performance for large data fetches

Support for different output formats (CSV, Parquet, etc.)


🌟 Show Your Support

If you find this tool helpful, please consider ⭐ starring the repository on GitHub!

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

kafka_replay-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

kafka_replay-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file kafka_replay-0.1.0.tar.gz.

File metadata

  • Download URL: kafka_replay-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.7

File hashes

Hashes for kafka_replay-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4468da5fc46fb2bb6878657e1534eb618e81a3f0709c725b9361e5c9a7e6c0a4
MD5 0e9253f9ce132bba537fdbccca1f3904
BLAKE2b-256 b2890cc96676d7d82fdb83bafbe290e1f4a4a430e377698f6ce5de8ae978662d

See more details on using hashes here.

File details

Details for the file kafka_replay-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kafka_replay-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.7

File hashes

Hashes for kafka_replay-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7026822041f8968bf075388c48aabf2c00b57dc2a42e028be1cc85eed178204
MD5 58dab4513d5d533ef95842f3597c6259
BLAKE2b-256 32a836c7525bc788ae7ebbf1d0cb805a4d261519bb244bd583202606b2e1d888

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