if [ "$1" = "cleanup" ]
then
- docker-compose down -v
+ docker-compose down -v --remove-orphans
mvn clean
exit
fi
-trap 'kill $(jobs -p) 2>/dev/null' EXIT
-
-docker-compose up -d kafka-0 kafka-1 kafka-2 kafka-3 cli
+docker-compose up -d kafka-1 kafka-2 kafka-3 cli
+docker-compose rm -svf consumer
if [[
$(docker image ls -q $IMAGE) == "" ||
docker-compose up setup
docker-compose up -d producer
+docker-compose ps
+
+docker-compose up -d consumer
+sleep 5
+docker-compose stop consumer
+
+docker-compose start consumer
+sleep 5
-mvn spring-boot:run &
-sleep 10
-kill $(jobs -p)
-mvn spring-boot:run &
-sleep 10
-docker-compose stop producer
-kill $(jobs -p)
+docker-compose stop producer consumer
+docker-compose logs consumer
cli:
image: juplo/toolbox
command: sleep infinity
+ depends_on:
+ - kafka-1
+ - kafka-2
+ - kafka-3
producer:
image: juplo/simple-producer:1.0-SNAPSHOT
- command: producer
+ command: kafka:9092 test producer
+
+ consumer:
+ image: juplo/spring-consumer:1.0-SNAPSHOT
+ environment:
+ spring.kafka.bootstrap-servers: kafka:9092
+ spring.kafka.client-id: consumer
<groupId>de.juplo.kafka</groupId>
<artifactId>spring-consumer</artifactId>
- <version>1.0-SNAPSHOT</version>
<name>Spring Consumer</name>
<description>Super Simple Consumer-Group, that is implemented as Spring-Boot application and configured by Spring Kafka</description>
+ <version>1.0-SNAPSHOT</version>
<properties>
<java.version>11</java.version>
<build>
<plugins>
+ <plugin>
+ <groupId>pl.project13.maven</groupId>
+ <artifactId>git-commit-id-plugin</artifactId>
+ </plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
level:
root: INFO
de.juplo: DEBUG
+ org.springframework.kafka: INFO
server:
port: 8881