41 lines
2.1 KiB
Plaintext
41 lines
2.1 KiB
Plaintext
== What is this app?
|
|
|
|
This is an example of a Spring Cloud Stream processor using Kafka Streams support.
|
|
|
|
This example is a Spring Cloud Stream adaptation of this Kafka Streams sample: https://github.com/confluentinc/kafka-streams-examples/tree/4.0.0-post/src/main/java/io/confluent/examples/streams/interactivequeries/kafkamusic
|
|
|
|
This sample demonstrates the concept of interactive queries in kafka streams.
|
|
There is a REST service provided as part of the application that can be used to query the store interactively.
|
|
|
|
=== Running the app:
|
|
|
|
We will run 2 instances of the processor application to demonstrate that regardless of which instance hosts the keys, the REST endpoint will serve the requests.
|
|
For more information on how this is done, please take a look at the application code.
|
|
|
|
1. `docker-compose up -d`
|
|
|
|
2. Start the confluent schema registry: The following command is based on the confluent platform and assume that you are at the root of the confluent platform's root directory.
|
|
|
|
`./bin/schema-registry-start ./etc/schema-registry/schema-registry.properties`
|
|
|
|
3. Go to the root of the repository and do: `./mvnw clean package`
|
|
|
|
4. `java -jar target/kafka-streams-interactive-query-advanced-0.0.1-SNAPSHOT.jar`
|
|
|
|
5. On another terminal session:
|
|
|
|
`java -jar target/kafka-streams-interactive-query-advanced-0.0.1-SNAPSHOT.jar --server.port=8082 --spring.cloud.stream.kafka.streams.binder.configuration.application.server=localhost:8082'
|
|
|
|
5. Run the stand-alone `Producers` application to generate data and start the processing.
|
|
Keep it running for a while.
|
|
|
|
6. Go to the URL: https://localhost:8080/charts/top-five?genre=Punk
|
|
keep refreshing the URL and you will see the song play count information changes.
|
|
|
|
Take a look at the console sessions for the applications and you will see that it may not be the processor started on 8080 that serves this request.
|
|
|
|
7. Go to the URL: https://localhost:8082/charts/top-five?genre=Punk
|
|
|
|
Take a look at the console sessions for the applications and you will see that it may not be the processor started on 8082 that serves this request.
|
|
|
|
8. Once you are done with running the sample, stop the docker containers and the schema registry. |