This project demonstrates a simple microservice app
- Producer receives two number via
REST API. - Producer sends numbers to kafka
sumtopic. - Consumer subscribes to
sumtopic and receives numbers and returns sum of numbers.
infradirectory includesdocker-composeto setup kafkaproducerdirectory includes a projects which send payloads to kafkaconsumerdirectory includes a project which receives payloads from kafka
After setup kafka and running producer and consumer you can call localhost:3000 by POST method.
Sample Payload:
{
"num1": 7,
"num2": 9
}
Sample Response:
Sum of 7 and 9 is: 16
By running npm run topic-list inside infra directory, you can see list of kafka topics.
Sample Response:
__consumer_offsets
sum
sum.reply