From: Kai Moritz Date: Mon, 1 Aug 2022 21:39:56 +0000 (+0200) Subject: Anpassungen des Projekts/Setups aus 'simple-producer' übernommen X-Git-Tag: spikzettel-DEPRECATED^2~3 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=4c4eaa9bf0d40ca631ac78d3a51c36cfcda4fe6f;p=demos%2Fkafka%2Ftraining Anpassungen des Projekts/Setups aus 'simple-producer' übernommen --- 4c4eaa9bf0d40ca631ac78d3a51c36cfcda4fe6f diff --cc Dockerfile index 0000000,ea4d335..3aefb4b mode 000000,100644..100644 --- a/Dockerfile +++ b/Dockerfile @@@ -1,0 -1,6 +1,6 @@@ + FROM openjdk:11-jre + VOLUME /tmp + COPY target/*.jar /opt/app.jar -COPY target/dependency /opt/libs -ENTRYPOINT [ "java", "-jar", "/opt/app.jar", "kafka:9092", "test" ] ++COPY target/libs /opt/libs ++ENTRYPOINT [ "java", "-jar", "/opt/app.jar", "kafka:9092", "test", "my-group" ] + CMD [ "DCKR" ] diff --cc README.sh index 0ee50a9,3f46c04..b1ba0be --- a/README.sh +++ b/README.sh @@@ -1,5 -1,7 +1,7 @@@ #!/bin/bash -IMAGE=juplo/simple-producer:1.0-SNAPSHOT ++IMAGE=juplo/simple-consumer:1.0-SNAPSHOT + if [ "$1" = "cleanup" ] then docker-compose down -v @@@ -16,18 -24,12 +24,13 @@@ f echo "Waiting for the Kafka-Cluster to become ready..." docker-compose exec cli cub kafka-ready -b kafka:9092 1 60 > /dev/null 2>&1 || exit 1 + docker-compose up setup + docker-compose up -d + sleep 5 - echo "Producing messages" - mvn exec:java@producer - - echo "Reading messages" - mvn exec:java@consumer & - sleep 7 - kill $(jobs -p) - sleep 2 + docker-compose exec cli kafkacat -b kafka:9092 -t test -q -c 20 -f'topic=%t\tpartition=%p\toffset=%o\tkey=%k\tvalue=%s\n' - echo "Re-Reading messages" - mvn exec:java@consumer & - sleep 7 - kill $(jobs -p) - sleep 2 -docker-compose stop producer -docker-compose exec cli kafkacat -b kafka:9092 -t test -q -e -f'topic=%t\tpartition=%p\toffset=%o\tkey=%k\tvalue=%s\n' -docker-compose logs producer ++docker-compose stop producer consumer-1 consumer-2 consumer-3 ++docker-compose logs consumer-1 ++docker-compose logs consumer-2 ++docker-compose logs consumer-3 diff --cc docker-compose.yml index ec307f5,d9f15c8..6ab0d1b --- a/docker-compose.yml +++ b/docker-compose.yml @@@ -35,3 -72,7 +72,19 @@@ services cli: image: juplo/toolbox command: sleep infinity + + producer: + image: juplo/simple-producer:1.0-SNAPSHOT + command: producer ++ ++ consumer-1: ++ image: juplo/simple-consumer:1.0-SNAPSHOT ++ command: consumer-1 ++ ++ consumer-2: ++ image: juplo/simple-consumer:1.0-SNAPSHOT ++ command: consumer-2 ++ ++ consumer-3: ++ image: juplo/simple-consumer:1.0-SNAPSHOT ++ command: consumer-3 diff --cc pom.xml index 2b39e97,4c52f37..b7c8a20 --- a/pom.xml +++ b/pom.xml @@@ -34,21 -34,56 +34,56 @@@ - org.codehaus.mojo - exec-maven-plugin - 3.0.0 + pl.project13.maven + git-commit-id-plugin + + + org.apache.maven.plugins + maven-dependency-plugin - producer + copy-dependencies + package + + copy-dependencies + - de.juplo.kafka.SimpleProducer + ${project.build.directory}/libs - - consumer - + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + libs/ - de.juplo.kafka.SimpleProducer + de.juplo.kafka.SimpleConsumer - + + + + + + io.fabric8 + docker-maven-plugin + 0.33.0 + + + + juplo/%a:%v + + + + + + build + package + + build +