A very simple RESTful API that serves data from a Kafka (Global)KTable
This project is a mash up of the following tutorials
# Query value with key from a KTable
GET /keys/${key}
{
"value": ${ktableValue}
}
.
├── src/main/scala/com/example
| ├── JsonSupport.scala #
| └── OKTable.scala # init KStream and KTable
| └── QuickstartServer.scala # main()
| └── MyRegistryActor.scala #
| └── MyRoutes.scala # API routes
- Download and Install Confluent Kafka
# Start the console producer and send key:value message (e.g. "a:123")
# to the "test" topic
#
kafka-console-producer \
--broker-list localhost:9092 \
--topic test \
--property "parse.key=true" \
--property "key.separator=:"
# Start a consumer (in another window) and watch your messages arrive
#
kafka-console-consumer \
--bootstrap-server localhost:9092 \
--topic test \
--from-beginning
$ sbt
...
> run
...