This project provides a simple messaging service that allows publishing and consuming messages through Kafka. It includes an API for message publishing and a consumer for message consumption.
- Publish messages to Kafka through a simple API.
- Consume messages from Kafka using a consumer.
- Configurable settings for Kafka connection and topics.
Make sure you have the following installed before setting up and running the messaging service:
- Kafka
- Zookeeper
This project provides zk-single-kafka-single.yaml
you can run this command to easy setup Kafka and Zookeeper using docker
docker-compose -f zk-single-kafka-single.yaml up -d
Copy config.sample.yaml
to config.yaml
and modify based on your needs.
make install
make build
./bin/kafkid producer
To publish a message to Kafka, use the provided API. Replace the placeholder values with your actual data.
POST http://localhost:8123/v1/publish
{
"topic": "notification",
"message": {
"test": "oke",
"isEnabled": 1
}
// "message": "you can send any type of message"
}
make build
./bin/kafkid consumer --topics=topic1,topic2
After you ran this command, the consumed message will be printed in console log
Contributions are welcome! Please follow the Contribution Guidelines.
This project is licensed under the MIT License.