1 # Implementation of the Outbox-Pattern for Apache Kafka
3 This Repository holds the source code for
4 [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/).
6 Execute [README.sh](README.sh) in a shell to demonstrate the example:
12 * compile the two components,
13 * package them as Docker-Images,
14 * start up the components and a minimal Kafka Cluster as containers in a [Compose-Setup](docker-compose.yml),
15 * execute example-queries (CREATE / DELETE) against the API of [the example-project](https://juplo.de/implementing-the-outbox-pattern-with-kafka-part-0-the-example/) and
16 * tail the logs of the containers `jdbc` and `kafkacat` to show what is going on.
18 You can verify the expected outcome of the demonstration by running a command like the following:
20 $ docker-compose logs kafkacat | grep peter
21 kafkacat_1 | peter1:"CREATED"
22 kafkacat_1 | peter2:"CREATED"
23 kafkacat_1 | peter3:"CREATED"
24 kafkacat_1 | peter4:"CREATED"
25 kafkacat_1 | peter5:"CREATED"
26 kafkacat_1 | peter6:"CREATED"
27 kafkacat_1 | peter7:"CREATED"
30 The example-output shows, that the CREATE-event for users with "peter" in their username are only issued exactly once, although the script issues several requests for each of these users.
32 Be aware, that the outcome of the script will be different, if you run it several times.
33 In order to reproduce the same behaviour, you have to shut down the Compose-Setup before rerunning the script:
35 docker-compose down -v
38 To clean up all created artifacts one can run: