FROM openjdk:11-jre
VOLUME /tmp
COPY target/*.jar /opt/app.jar
-ENTRYPOINT [ "java", "-jar", "/opt/app.jar", "kafka:9092", "test" ]
-CMD [ "DCKR" ]
+ENTRYPOINT [ "java", "-jar", "/opt/app.jar" ]
+CMD []
if [ "$1" = "cleanup" ]
then
- docker-compose down -v
+ docker-compose down -v --remove-orphans
mvn clean
exit
fi
fi
docker-compose up setup
+docker-compose ps
+
docker-compose up -d acks-all acks-1
sleep 5
docker-compose stop kafka-1
depends_on:
- kafka-0
+
setup:
image: juplo/toolbox
command: >
cli:
image: juplo/toolbox
command: sleep infinity
+ depends_on:
+ - kafka-1
+ - kafka-2
+ - kafka-3
acks-all:
image: juplo/supersimple-producer:1.0-SNAPSHOT
<groupId>de.juplo.kafka</groupId>
<artifactId>supersimple-producer</artifactId>
- <version>1.0-SNAPSHOT</version>
<name>Super Simple Producer</name>
<description>Most minimal Kafka Producer ever!</description>
+ <version>1.0-SNAPSHOT</version>
<properties>
<java.version>11</java.version>
{
for (int i = 0; true; i++)
{
- // tag::callback[]
ListenableFuture<SendResult<String, String>> listenableFuture =
kafkaTemplate.send("test", Long.toString(i%10), Long.toString(i));
result.getRecordMetadata().partition(),
result.getRecordMetadata().offset()),
e -> log.error("ERROR sendig message", e));
- // end::callback[]
try
{