Simple application build to learn Kafka.
This app consumes events, process them, and store them in ElasticSearch.
Tracks users recent searched products.
- Before running, make sure to spin up Kafka with zookeeper and Elasticsearch with Kibana on your machine
- Configure the kafka bootstrap addr, and Elasticsearch url in .env file (take look in .env.example)
- Run the mapping query present in scripts/es-mapping.sh
- After that, you are good to go, just do
go mod tidy
and thenmake run
- To run kafka with zookeeper, run each of the below in separate terminal
-> bin/zookeeper-server-start.sh config/zookeeper.properties
-> bin/kafka-server-start.sh config/server.properties
- To publish & consume events from the topic, run each of the below in separate terminal
-> bin/kafka-console-consumer.sh --topic <topic_name> --from-beginning --bootstrap-server localhost:9092
-> bin/kafka-console-producer.sh --topic GoActivityTopic --bootstrap-server localhost:9092
Sample message to publish:
{"application":"GoActivityApp","source":"JosuApp","userId":"10101","timestamp":"1725562535000","productId":"100","actionType":"s"}