# Implementation of the Outbox-Pattern for Apache Kafka
This Repository holds the source code for
-[a blog-series that explains a technically complete implementation of the outbox-pattern for Apache Kafka](https://juplo.de/implementing-the-outbox-pattern-with-kafka-part-1-the-outbox-table/).
+[a blog-series that explains a technically complete implementation of the outbox-pattern for Apache Kafka](https://juplo.de/implementing-the-outbox-pattern-with-kafka-part-2-sending-messages-from-the-outbox/).
Execute [README.sh](README.sh) in a shell to demonstrate the example:
then
docker-compose down -v
mvn clean
- docker image rm juplo/data-jdbc:polling-outbox-2-SNAPSHOT
- docker image rm juplo/outbox-delivery:polling-outbox-2-SNAPSHOT
+ docker image rm juplo/data-jdbc:polling-outbox-2
+ docker image rm juplo/outbox-delivery:polling-outbox-2
exit
fi
docker-compose up -d zookeeper kafka
if [[
- $(docker image ls -q juplo/data-jdbc:polling-outbox-2-SNAPSHOT) == "" ||
- $(docker image ls -q juplo/outbox-delivery:polling-outbox-2-SNAPSHOT) == "" ||
+ $(docker image ls -q juplo/data-jdbc:polling-outbox-2) == "" ||
+ $(docker image ls -q juplo/outbox-delivery:polling-outbox-2) == "" ||
"$1" = "build"
]]
then
mvn install || exit
else
echo "Using image existing images:"
- docker image ls juplo/data-jdbc:polling-outbox-2-SNAPSHOT
- docker image ls juplo/outbox-delivery:polling-outbox-2-SNAPSHOT
+ docker image ls juplo/data-jdbc:polling-outbox-2
+ docker image ls juplo/outbox-delivery:polling-outbox-2
fi
while ! [[ $(docker-compose exec kafka zookeeper-shell zookeeper:2181 ls /brokers/ids 2> /dev/null) =~ 1001 ]];
echo franz$i | http :8080/users
echo beate$i | http :8080/users
http DELETE :8080/users/uwe$i
- sleep 1
done;
docker-compose exec postgres psql -Uoutbox -c'SELECT * FROM outbox;' -Ppager=0 outbox
+docker-compose logs kafkacat | grep peter
# "kill" the executions of "docker-compose logs ..."
docker-compose stop jdbc kafkacat
<groupId>de.juplo.kafka.outbox</groupId>
<artifactId>outbox-delivery</artifactId>
- <version>polling-outbox-2-SNAPSHOT</version>
+ <version>polling-outbox-2</version>
<name>Outbox-Delivery (Polling)</name>
<description>Simple example-implementation of the Outbox-Pattern (polling variant)</description>
- kafka
jdbc:
- image: juplo/data-jdbc:polling-outbox-2-SNAPSHOT
+ image: juplo/data-jdbc:polling-outbox-2
ports:
- 8080:8080
environment:
- postgres
outbox:
- image: juplo/outbox-delivery:polling-outbox-2-SNAPSHOT
+ image: juplo/outbox-delivery:polling-outbox-2
environment:
spring.profiles.active: prod
logging.level.de.juplo.kafka.outbox: DEBUG
-Subproject commit bd0d27231000709358794cf034ab6c2b0b3db8ab
+Subproject commit 7c43d44ee5deac1d1dc6680a30c5131ac5a023ba
<groupId>de.juplo.kafka.outbox</groupId>
<artifactId>polling-outbox-parent</artifactId>
- <version>polling-outbox-2-SNAPSHOT</version>
+ <version>polling-outbox-2</version>
<packaging>pom</packaging>
<name>polling-outbox-parent</name>
<description>Simple example-implementation of the Polling-Outbox-Pattern</description>
<groupId>de.juplo.kafka.outbox</groupId>
<artifactId>outbox-postage</artifactId>
- <version>polling-outbox-2-SNAPSHOT</version>
+ <version>polling-outbox-2</version>
<name>outbox-postage</name>
<description>Simple example-implementation of the Polling-Outbox-Pattern</description>