This code is the companion of the blog post Proof of concept using KafkaStreams and KTables.
There is a longer explanation of the code at Proof of concept using KafkaStreams and KTables - implementation notes, gotchas and Docker Compose example
This project uses Docker to create a cluster of 3 microservices that consume from a Kafka topic using the Kafka Streams API.
The main processing function is here.
Docker should be installed.
To run:
docker-compose -p ktable-demo -f docker-compose.yml up
Once the environment has been started, you can add new positions with:
curl --data "client=client1&exchange=NASDAQ&amount=1&ticker=AAPL" -X POST http://localhost:3004/set-shares
To remove a position, just set the amount to 0:
curl --data "client=client1&exchange=NASDAQ&amount=0&ticker=AAPL" -X POST http://localhost:3004/set-shares
To get rid of all:
docker-compose -p ktable-demo -f docker-compose.yml down --rmi all --remove-orphans
docker image rm pandeiro/lein:2.5.2 wurstmeister/kafka:0.10.1.0-1