Added data-jdbc as git submodule jdbc
[demos/kafka/outbox] / README.md
1 # Implementation of the Outbox-Pattern for Apache Kafka
2
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/).
5
6 Execute [README.sh](README.sh) in a shell to demonstrate the example:
7
8     ./README.sh
9
10 The script will...
11
12 * compile the component,
13 * package it as Docker-Images,
14 * start up the component and a PostreSQL 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` to show what is going on.
17
18 You can verify the expected outcome of the demonstration by running a command like the following:
19
20     $ docker-compose exec postgres psql -Uoutbox -c'SELECT * FROM outbox;' -Ppager=0  outbox | grep peter
21       1 | peter1  | "CREATED" | 2021-05-16 13:20:36.849
22      10 | peter2  | "CREATED" | 2021-05-16 13:20:42.141
23      19 | peter3  | "CREATED" | 2021-05-16 13:20:47.136
24      28 | peter4  | "CREATED" | 2021-05-16 13:20:52.087
25      37 | peter5  | "CREATED" | 2021-05-16 13:20:57.512
26      46 | peter6  | "CREATED" | 2021-05-16 13:21:02.493
27      55 | peter7  | "CREATED" | 2021-05-16 13:21:07.503
28     $
29
30 The example-output shows, that the CREATE-event for users with "peter" in their username are only stored exactly once in the outbox-table, although the script issues several requests for each of these users.
31
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:
34
35     docker-compose down -v
36     ./README.sh
37
38 To clean up all created artifacts one can run:
39
40     ./README.sh cleanup