forked from confluentinc/kafka-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Makefile, input data and expected test outputs (#99)
- Loading branch information
Showing
23 changed files
with
145 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
_includes/tutorials/window-final-result/kstreams/code/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
STEPS_DIR := tutorial-steps | ||
DEV_OUTPUTS_DIR := $(STEPS_DIR)/dev/outputs | ||
TEMP_DIR := $(shell mktemp -d) | ||
|
||
tutorial: | ||
rm -r $(DEV_OUTPUTS_DIR) || true | ||
mkdir $(DEV_OUTPUTS_DIR) | ||
harness-runner ../../../../../_data/harnesses/window-final-result/kstreams.yml $(TEMP_DIR) | ||
bash -c 'diff --strip-trailing-cr <(cat $(STEPS_DIR)/dev/expected-count.txt) <(cat $(DEV_OUTPUTS_DIR)/actual-count.txt)' |
2 changes: 1 addition & 1 deletion
2
...ludes/tutorials/window-final-result/kstreams/code/tutorial-steps/dev/docker-compose-up.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
docker-compose up -d | ||
docker-compose up |
4 changes: 4 additions & 0 deletions
4
_includes/tutorials/window-final-result/kstreams/code/tutorial-steps/dev/expected-count.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
5 | ||
1 | ||
1 | ||
2 |
3 changes: 3 additions & 0 deletions
3
...es/tutorials/window-final-result/kstreams/code/tutorial-steps/dev/run-consumer-execute.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
docker exec -it broker /usr/bin/kafka-console-consumer --topic output-topic --bootstrap-server broker:9092\ | ||
--property value.deserializer=org.apache.kafka.common.serialization.LongDeserializer\ | ||
--from-beginning | grep -v "org.apache.kafka" |
2 changes: 2 additions & 0 deletions
2
...udes/tutorials/window-final-result/kstreams/code/tutorial-steps/dev/run-producer-alias.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
set +m | ||
function produce () { echo $1 | docker exec -i schema-registry /usr/bin/kafka-avro-console-producer --broker-list broker:9092 --topic input-topic --property value.schema="$(< src/main/avro/pressure-alert.avsc)" & } |
18 changes: 18 additions & 0 deletions
18
...es/tutorials/window-final-result/kstreams/code/tutorial-steps/dev/run-producer-execute.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# 1. Here we have to pint the event times to ensure the same result | ||
# 2. The produce use here doesn't run in background like in the tutorial | ||
|
||
function produce () { echo $1 | docker exec -i schema-registry /usr/bin/kafka-avro-console-producer --broker-list broker:9092 --topic input-topic --property value.schema="$(< src/main/avro/pressure-alert.avsc)"; } | ||
|
||
produce '{"id":"XXX","datetime":"2019-09-21T05:00:00.+0200","pressure":30}' | ||
produce '{"id":"101","datetime":"2019-09-21T05:45:02.+0200","pressure":30}' | ||
produce '{"id":"101","datetime":"2019-09-21T05:45:02.+0200","pressure":30}' | ||
produce '{"id":"101","datetime":"2019-09-21T05:45:02.+0200","pressure":30}' | ||
produce '{"id":"102","datetime":"2019-09-21T05:45:02.+0200","pressure":30}' | ||
produce '{"id":"101","datetime":"2019-09-21T05:45:02.+0200","pressure":30}' | ||
produce '{"id":"101","datetime":"2019-09-21T05:45:07.+0200","pressure":30}' | ||
produce '{"id":"101","datetime":"2019-09-21T05:44:13.+0200","pressure":30}' | ||
produce '{"id":"102","datetime":"2019-09-21T05:45:13.+0200","pressure":30}' | ||
produce '{"id":"102","datetime":"2019-09-21T05:43:23.+0200","pressure":30}' | ||
produce '{"id":"301","datetime":"2019-09-21T12:45:23.+0900","pressure":30}' | ||
produce '{"id":"301","datetime":"2019-09-21T12:45:24.+0900","pressure":30}' | ||
produce '{"id":"XXX","datetime":"2019-09-21T06:00:00.+0200","pressure":30}' |
18 changes: 16 additions & 2 deletions
18
_includes/tutorials/window-final-result/kstreams/code/tutorial-steps/dev/run-producer.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
set +m | ||
function produce () { echo $1 | docker exec -i schema-registry /usr/bin/kafka-avro-console-producer --broker-list broker:9092 --topic input-topic --property value.schema="$(< src/main/avro/pressure-alert.avsc)" & } | ||
produce '{"id":"XXX","datetime":"'$(date +%FT%T.%z)'","pressure":30}' | ||
produce '{"id":"101","datetime":"'$(date +%FT%T.%z)'","pressure":30}' | ||
produce '{"id":"101","datetime":"'$(date +%FT%T.%z)'","pressure":30}' | ||
produce '{"id":"101","datetime":"'$(date +%FT%T.%z)'","pressure":30}' | ||
produce '{"id":"102","datetime":"'$(date +%FT%T.%z)'","pressure":30}' | ||
sleep 10 | ||
produce '{"id":"101","datetime":"'$(date -v-10S +%FT%T.%z)'","pressure":30}' # late of 10 sec | ||
produce '{"id":"101","datetime":"'$(date -v-15S +%FT%T.%z)'","pressure":30}' # late of 15 sec | ||
produce '{"id":"101","datetime":"'$(date -v-60S +%FT%T.%z)'","pressure":30}' # late of 01 min | ||
produce '{"id":"102","datetime":"'$(date +%FT%T.%z)'","pressure":30}' | ||
sleep 10 | ||
produce '{"id":"102","datetime":"'$(date -v-60S +%FT%T.%z)'","pressure":30}' # out of the grace period | ||
export TZ=Asia/Tokyo | ||
produce '{"id":"301","datetime":"'$(date +%FT%T.%z)'","pressure":30}' | ||
produce '{"id":"301","datetime":"'$(date +%FT%T.%z)'","pressure":30}' | ||
produce '{"id":"XXX","datetime":"'$(date +%FT%T.%z)'","pressure":30}' |
14 changes: 0 additions & 14 deletions
14
_includes/tutorials/window-final-result/kstreams/code/tutorial-steps/dev/run-producer2.sh
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
...des/tutorials/window-final-result/kstreams/code/tutorial-steps/dev/wait-for-containers.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Wait for Schema Registry to become available | ||
while [ $(curl -s -o /dev/null -w %{http_code} http://localhost:8081/) -eq 000 ] | ||
do | ||
echo -e $(date) "Schema Registry HTTP state: " $(curl -s -o /dev/null -w %{http_code} http://localhost:8081/) " (waiting for 200)" | ||
sleep 5 | ||
done |
2 changes: 1 addition & 1 deletion
2
...rials/window-final-result/kstreams/code/tutorial-steps/prod/launch-container-conf-file.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
docker run -v $PWD/configuration/prod.properties:/config.properties io.confluent.developer/kstreams-filter:0.0.1-SNAPSHOT -Dconfig.file=config.properties | ||
docker run -v $PWD/configuration/prod.properties:/config.properties io.confluent.developer/kstreams-window-final-result:0.0.1-SNAPSHOT -Dconfig.file=/config.properties |
2 changes: 1 addition & 1 deletion
2
...torials/window-final-result/kstreams/code/tutorial-steps/prod/launch-container-env-var.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
docker run\ | ||
-e "BOOTSTRAP_SERVERS=broker:9092"\ | ||
-e "SCHEMA_REGISTRY_URL=http://schema-registry:8081"\ | ||
io.confluent.developer/kstreams-filter:0.0.1-SNAPSHOT | ||
io.confluent.developer/kstreams-window-final-result:0.0.1-SNAPSHOT |
1 change: 1 addition & 0 deletions
1
...tutorials/window-final-result/kstreams/code/tutorial-steps/prod/make-configuration-dir.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mkdir configuration |
1 change: 1 addition & 0 deletions
1
...s/tutorials/window-final-result/kstreams/code/tutorial-steps/test/make-test-config-dir.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mkdir -p src/test/resources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...tutorials/window-final-result/kstreams/markup/dev/1_2-start-docker-compose.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
And launch it by running: | ||
|
||
+++++ | ||
<pre class="snippet"><code class="shell">{% include_raw tutorials/window-final-result/kstreams/code/tutorial-steps/dev/docker-compose-up.sh %}</code></pre> | ||
+++++ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
.../tutorials/window-final-result/kstreams/markup/prod/1_0-make-prod-conf-dir.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
First, create a directory for the configuration: | ||
|
||
+++++ | ||
<pre class="snippet"><code class="bash">{% | ||
include_raw tutorials/window-final-result/kstreams/code/tutorial-steps/prod/make-configuration-dir.sh | ||
%}</code></pre> | ||
+++++ |
2 changes: 1 addition & 1 deletion
2
...reams/markup/prod/1_0-make-prod-conf.adoc → ...reams/markup/prod/1_1-make-prod-conf.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...utorials/window-final-result/kstreams/markup/test/1_0-make-test-config-dir.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
First, create a directory for the test configuration: | ||
|
||
+++++ | ||
<pre class="snippet"><code class="bash">{% | ||
include_raw tutorials/window-final-result/kstreams/code/tutorial-steps/test/make-test-config-dir.sh | ||
%}</code></pre> | ||
+++++ |
2 changes: 1 addition & 1 deletion
2
...reams/markup/test/1_0-make-test-conf.adoc → ...reams/markup/test/1_1-make-test-conf.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters