Source code for a demo on querying the state store in Apache Flink for a talk at the Bengaluru Streams meetup. The recoding of the talk can be found on YouTube.
- Build the Flink job JAR
cd flink-job
mvn clean package
- Bring up the environment
docker-compose up -d broker flink-jobmanager flink-taskmanager
- Start the producer
docker-compose up -d producer
- Submit job to jobmanager
docker-compose up -d submit
- Start query client application
docker-compose logs submit
# Copy job ID from the line `Job has been submitted with JobID cece02e443b75ce6dcbe46d2a4f5a742`
# Here cece02e443b75ce6dcbe46d2a4f5a742 is the JobID, replace it with your own
# Replace the job ID in the client parameters
sed -i 's/flinkJobID/cece02e443b75ce6dcbe46d2a4f5a742/g' docker-compose.yml
docker-compose up -d query-client
- Query the state store
curl localhost:8080/query/household_1
# {"key":"household_1", "average_voltage":241.12, "minimum_voltage":0.00, "maximum_voltage":249.48}
curl localhost:8080/query/household_2
# {"key":"household_2", "average_voltage":391.97, "minimum_voltage":0.00, "maximum_voltage":448.97}