hairy-lemon
is an implementation of a Kafka producer application.
- Exposes API to some values to the user by taking unique id as an input value
- DB mockup for storing and returning values to the user when queried with a unique id
- Implements a Kafka producer to publish a successful query
To run the full capability, you'll need both the producer hairy-lemon and the consumer copper-face-jacks. hairy-lemon
is only 50% of the capability.
Below is the bird's eye view of the e2e initiative. The red enclosure represents hairy-lemon
.
- go v1.13.1+
- kafka container shopify/kafka
- dep for managing dependencies
-
Clone hairy-lemon.
-
Navigate to the
hairy-lemon
folder and run the program in your terminal by executing:go run hairy-lemon
-
To initialize a kafka instance:
a). Copy the yaml file to desktop. Open yaml file, and delete everything apart from
zookeeper
andbroker
configs. Save the file. Next, execute below commands in cli:$ docker-compose up $ docker ps
b). Run below command to enter the container:
$ docker exec -it testdocker /bin/bash
c). To get into the kafka consumer and initialize it, run the following:
$ cd /opt/kafka_2.11-0.10.1.0/bin/ $ ./kafka-console-consumer.sh --bootstrap-server $ localhost:9092 --topic newtopic --from-beginning
Note: Running Step 3c will display the messages in kafka and test.
-
hairy-lemon
is launched and the kafka consumer is initialized. Proceed to open browser and hit the url athttp://localhost:8081/score/1
You will see a json response on the webpage. The same response can be seen in the kafka container. Effectively, UniqueId = 1
is queried on the DB via API. The corresponding values are given in the response. These values are then published to the kafka topic, and you can view them on the kafka consumer terminal accordingly.
Maximum respect and many thanks to the developers on these open-source projects for making hairy-lemon
possible:
rcrowley/go-metrics
jcmturner/gofork
klauspost/compress
go-redis/redis
golang/snappy
hashicorp/go-uuid
pierrec/lz4
eapache @ Shopify
davecgh/go-spew