Skip to content

NAGARAJ08/kafka-replay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

Releases

No releases published

Packages

No packages published

Languages