Skip to content

A very simple RESTful API that serves data from a Kafka (Global)KTable

Notifications You must be signed in to change notification settings

markhopson/akka-http-quickstart-scala-kafka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

akka-http-quickstart-scala-kafka

A very simple RESTful API that serves data from a Kafka (Global)KTable

This project is a mash up of the following tutorials

API Spec

# Query value with key from a KTable

GET /keys/${key}
{
  "value": ${ktableValue}
}

Directory Structure

.
├── src/main/scala/com/example
|   ├── JsonSupport.scala           # 
|   └── OKTable.scala               # init KStream and KTable
|   └── QuickstartServer.scala      # main()
|   └── MyRegistryActor.scala     # 
|   └── MyRoutes.scala            # API routes

Requirements

# 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

Building and Running

$ sbt
...
> run
...

About

A very simple RESTful API that serves data from a Kafka (Global)KTable

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published