Skip to content

simple application build to learn Kafka, store data in Elasticsearch

Notifications You must be signed in to change notification settings

the-arcade-01/go-activity

Repository files navigation

go-activity

Simple application build to learn Kafka.
This app consumes events, process them, and store them in ElasticSearch.
Tracks users recent searched products.

Run

  1. Before running, make sure to spin up Kafka with zookeeper and Elasticsearch with Kibana on your machine
  2. Configure the kafka bootstrap addr, and Elasticsearch url in .env file (take look in .env.example)
  3. Run the mapping query present in scripts/es-mapping.sh
  4. After that, you are good to go, just do go mod tidy and then make run

Commands

  1. 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
  1. 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"}

Diagram

Application Diagram

About

simple application build to learn Kafka, store data in Elasticsearch

Topics

Resources

Stars

Watchers

Forks