How to use Kotlin and Ktor to build applications which share geographical coordinates.
Note
|
Get Mapbox API key https://account.mapbox.com/access-tokens/create |
-
✓ modules for driver and rider
-
✓ routes to separate file
-
✓ js files for rider UI
-
✓ create topics via config
docker stuff
# TODO: replace with TC
./gradlew composeUp #(1)
docker exec -it broker /usr/bin/kafka-topics --bootstrap-server broker:9092 --list #(2)
docker exec -it broker /usr/bin/kafka-console-consumer --topic driver --bootstrap-server broker:9092 --property print.key=true --from-beginning #(3)
docker exec -it broker /usr/bin/kafka-console-consumer --topic rider --bootstrap-server broker:9092 --property print.key=true --from-beginning #(4)
-
start zk and ak
-
check if everything is there
-
read driver topic
-
read rider topic
Add command line argument:
-
For driver app: -config=src/main/resources/driver.conf
-
For rider app: -config=src/main/resources/rider.conf
To run both modules in the same application, just run as usual, without -config
.
In this case, application.conf
will be used
Run Rider and Driver apps separately
./gradlew build #(1)
java -cp build/libs/kafkazavr-0.0.1-all.jar io.kafkazavr.ApplicationKt -config=src/main/resources/driver.conf #(2)
java -cp build/libs/kafkazavr-0.0.1-all.jar io.kafkazavr.ApplicationKt -config=src/main/resources/rider.conf #(3)
# or same with Gradle application plugin
./gradlew run --args="-config=src/main/resources/driver.conf" #(2)
./gradlew run --args="-config=src/main/resources/rider.conf" #(3)
-
build shadow jar
-
run driver app
-
run rider app